util: distro: Refactor family and distro code
I hate writing abstraction code like this, but I'm hoping it will be useful.
This commit is contained in:
@@ -9,7 +9,7 @@ import "fmt"
|
||||
class xclass {
|
||||
#import "os" # this should not be required, top-level should be enough
|
||||
|
||||
$aaa = if os.is_debian() { "bbb" } else { "ccc" }
|
||||
$aaa = if os.is_family_debian() { "bbb" } else { "ccc" }
|
||||
|
||||
print "${aaa}" {
|
||||
msg => "hello",
|
||||
|
||||
@@ -9,11 +9,11 @@ import "fmt"
|
||||
|
||||
class xclass {
|
||||
# note that `os` is not imported here
|
||||
$aaa = if os.is_debian() { "bbb" } else { "ccc" }
|
||||
$aaa = if os.is_family_debian() { "bbb" } else { "ccc" }
|
||||
|
||||
print "${aaa}" {
|
||||
msg => "hello",
|
||||
}
|
||||
}
|
||||
-- OUTPUT --
|
||||
# err: errSetScope: func `os.is_debian` does not exist in this scope
|
||||
# err: errSetScope: func `os.is_family_debian` does not exist in this scope
|
||||
|
||||
@@ -8,7 +8,7 @@ import "fmt"
|
||||
class xclass {
|
||||
import "os" # we can also use a scoped local import
|
||||
|
||||
$aaa = if os.is_debian() { "bbb" } else { "ccc" }
|
||||
$aaa = if os.is_family_debian() { "bbb" } else { "ccc" }
|
||||
|
||||
print "${aaa}" {
|
||||
msg => "hello",
|
||||
|
||||
Reference in New Issue
Block a user