...
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
# OSAL Core Module - Key Capabilities (incubaid.herolib.osal.core)
|
||||
|
||||
> **Note:** Platform detection functions (`platform()` and `cputype()`) have moved to `incubaid.herolib.core`.
|
||||
> Use `import incubaid.herolib.core` and call `core.platform()!` and `core.cputype()!` instead.
|
||||
|
||||
```v
|
||||
//example how to get started
|
||||
|
||||
@@ -68,8 +71,8 @@ This document describes the core functionalities of the Operating System Abstrac
|
||||
* **`osal.process_kill_recursive(args: ProcessKillArgs) !`**: Kill a process and its children.
|
||||
* **Key Parameters**: `name` (string), `pid` (int).
|
||||
* **`osal.whoami() !string`**: Return the current username.
|
||||
* **`osal.platform() !PlatformType`**: Identify the operating system.
|
||||
* **`osal.cputype() !CPUType`**: Identify the CPU architecture.
|
||||
* ~~**`osal.platform() !PlatformType`**: Identify the operating system.~~ → **Moved to `incubaid.herolib.core`**
|
||||
* ~~**`osal.cputype() !CPUType`**: Identify the CPU architecture.~~ → **Moved to `incubaid.herolib.core`**
|
||||
* **`osal.hostname() !string`**: Get system hostname.
|
||||
* **`osal.sleep(duration int)`**: Pause execution for a specified duration.
|
||||
* **`osal.download(args: DownloadArgs) !pathlib.Path`**: Download a file from a URL.
|
||||
|
||||
@@ -343,8 +343,6 @@ This document describes the core functionalities of the Operating System Abstrac
|
||||
- **`osal.process_kill_recursive(args: ProcessKillArgs) !`**: Kill a process and its children.
|
||||
- **Key Parameters**: `name` (string), `pid` (int).
|
||||
- **`osal.whoami() !string`**: Return the current username.
|
||||
- **`osal.platform() !PlatformType`**: Identify the operating system.
|
||||
- **`osal.cputype() !CPUType`**: Identify the CPU architecture.
|
||||
- **`osal.hostname() !string`**: Get system hostname.
|
||||
- **`osal.sleep(duration int)`**: Pause execution for a specified duration.
|
||||
- **`osal.download(args: DownloadArgs) !pathlib.Path`**: Download a file from a URL.
|
||||
@@ -354,8 +352,31 @@ This document describes the core functionalities of the Operating System Abstrac
|
||||
- **`osal.user_id_get(username string) !int`**: Get user ID.
|
||||
- **`osal.user_add(args: UserArgs) !int`**: Add a user.
|
||||
- **Key Parameters**: `name` (string).
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
## 7. Platform Information
|
||||
|
||||
* **`core.platform() !PlatformType`**: Identify the operating system.
|
||||
* **Returns**: Platform type (osx, ubuntu, arch, etc.)
|
||||
* **`core.cputype() !CPUType`**: Identify the CPU architecture.
|
||||
* **Returns**: CPU type (intel, arm, etc.)
|
||||
|
||||
### Usage Example
|
||||
|
||||
```v
|
||||
import incubaid.herolib.core
|
||||
|
||||
platform := core.platform()! // Returns .osx, .ubuntu, etc.
|
||||
cpu := core.cputype()! // Returns .intel, .arm, etc.
|
||||
|
||||
match platform {
|
||||
.osx { println('Running on macOS') }
|
||||
.ubuntu { println('Running on Ubuntu') }
|
||||
.arch { println('Running on Arch Linux') }
|
||||
else { println('Other platform') }
|
||||
}
|
||||
```
|
||||
|
||||
# OurTime Module
|
||||
|
||||
|
||||
Reference in New Issue
Block a user