postgresql & new docs
This commit is contained in:
@@ -5,7 +5,6 @@ import os
|
||||
// import freeflowuniverse.herolib.ui.console
|
||||
// Returns the enum value that matches the provided string for PlatformType
|
||||
|
||||
|
||||
pub enum PlatformType {
|
||||
unknown
|
||||
osx
|
||||
@@ -25,7 +24,6 @@ pub fn platform_enum_from_string(platform string) PlatformType {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Returns the enum value that matches the provided string for CPUType
|
||||
pub fn cputype_enum_from_string(cputype string) CPUType {
|
||||
return match cputype.to_lower() {
|
||||
@@ -54,7 +52,7 @@ pub fn cmd_exists(cmd string) bool {
|
||||
return true
|
||||
}
|
||||
|
||||
pub fn platform()! PlatformType {
|
||||
pub fn platform() !PlatformType {
|
||||
mut platform_ := PlatformType.unknown
|
||||
platform_ = platform_enum_from_string(memdb_get('platformtype'))
|
||||
if platform_ != PlatformType.unknown {
|
||||
@@ -77,18 +75,18 @@ pub fn platform()! PlatformType {
|
||||
return platform_
|
||||
}
|
||||
|
||||
pub fn cputype()! CPUType {
|
||||
pub fn cputype() !CPUType {
|
||||
mut cputype_ := CPUType.unknown
|
||||
cputype_ = cputype_enum_from_string(memdb_get('cputype'))
|
||||
if cputype_ != CPUType.unknown {
|
||||
return cputype_
|
||||
}
|
||||
res := os.execute('uname -m')
|
||||
if res.exit_code >0{
|
||||
if res.exit_code > 0 {
|
||||
return error("can't execute uname -m")
|
||||
}
|
||||
sys_info := res.output
|
||||
|
||||
|
||||
cputype_ = match sys_info.to_lower().trim_space() {
|
||||
'x86_64' {
|
||||
CPUType.intel
|
||||
@@ -110,37 +108,37 @@ pub fn cputype()! CPUType {
|
||||
return cputype_
|
||||
}
|
||||
|
||||
pub fn is_osx()! bool {
|
||||
pub fn is_osx() !bool {
|
||||
return platform()! == .osx
|
||||
}
|
||||
|
||||
pub fn is_osx_arm()! bool {
|
||||
pub fn is_osx_arm() !bool {
|
||||
return platform()! == .osx && cputype()! == .arm
|
||||
}
|
||||
|
||||
pub fn is_osx_intel()! bool {
|
||||
pub fn is_osx_intel() !bool {
|
||||
return platform()! == .osx && cputype()! == .intel
|
||||
}
|
||||
|
||||
pub fn is_ubuntu()! bool {
|
||||
pub fn is_ubuntu() !bool {
|
||||
return platform()! == .ubuntu
|
||||
}
|
||||
|
||||
pub fn is_linux()! bool {
|
||||
pub fn is_linux() !bool {
|
||||
return platform()! == .ubuntu || platform()! == .arch || platform()! == .suse
|
||||
|| platform()! == .alpine
|
||||
}
|
||||
|
||||
pub fn is_linux_arm()!bool {
|
||||
pub fn is_linux_arm() !bool {
|
||||
// console.print_debug("islinux:${is_linux()!} cputype:${cputype()!}")
|
||||
return is_linux()! && cputype()! == .arm
|
||||
}
|
||||
|
||||
pub fn is_linux_intel()! bool {
|
||||
pub fn is_linux_intel() !bool {
|
||||
return is_linux()! && cputype()! == .intel
|
||||
}
|
||||
|
||||
pub fn hostname()!string {
|
||||
pub fn hostname() !string {
|
||||
res := os.execute('hostname')
|
||||
if res.exit_code > 0 {
|
||||
return error("can't get hostname. Error.")
|
||||
|
||||
Reference in New Issue
Block a user