Skip to content

Commit

Permalink
feat(stdlib): sort asc
Browse files Browse the repository at this point in the history
  • Loading branch information
Mte90 committed Sep 20, 2024
1 parent da29a93 commit e29e4c2
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 231 deletions.
80 changes: 40 additions & 40 deletions docs/stdlib/doc/date.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## `date_add`
```ab
pub fun date_add(add: Text, date: Text = "", utc: Bool = false): Text ?
```

### EXPERIMENTAL

Adds a value to a date.

If no date is specified, the current date is used.

Example : `date_add("+3 days")`

You can use (+/-):

- years
- months
- days
- hours
- minutes
- seconds


## `date_compare`
```ab
pub fun date_compare(date_a: Text, date_b: Text = "", utc: Bool = false): Num ?
```

### EXPERIMENTAL
Compares two dates.

Returns 1 if date_a is after date_b.

Returns 0 if date_a and date_b is the same.

Returns -1 if date_b is after date_a.

If date_b is not provided, current date will be used.


## `date_posix`
```ab
pub fun date_posix(format: Text = "", date: Text = "", utc: Bool = false): Text ?
Expand Down Expand Up @@ -83,43 +123,3 @@ pub fun now(): Num
Returns the current timestamp (seconds since the Epoch (1970-01-01 00:00 UTC)).


## `date_add`
```ab
pub fun date_add(add: Text, date: Text = "", utc: Bool = false): Text ?
```

### EXPERIMENTAL

Adds a value to a date.

If no date is specified, the current date is used.

Example : `date_add("+3 days")`

You can use (+/-):

- years
- months
- days
- hours
- minutes
- seconds


## `date_compare`
```ab
pub fun date_compare(date_a: Text, date_b: Text = "", utc: Bool = false): Num ?
```

### EXPERIMENTAL
Compares two dates.

Returns 1 if date_a is after date_b.

Returns 0 if date_a and date_b is the same.

Returns -1 if date_b is after date_a.

If date_b is not provided, current date will be used.


146 changes: 73 additions & 73 deletions docs/stdlib/doc/env.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,75 @@
## `get_env_var`
## `color_echo`
```ab
pub fun get_env_var(var: Text, file: Text = ".env"): Text
pub fun color_echo(message: Text, color: Num): Null
```

Retrieves the value of an environment variable, optionally sourcing it from a file if not already set.
Prints a text with a specified color.


## `load_env_file`
## `confirm`
```ab
pub fun load_env_file(file: Text = ".env"): Null
pub fun confirm(prompt: Text, default_yes: Bool = false): Bool
```

Loads the env file in the environment, using `xargs`.
Creates a confirm prompt (Yes/No), and returns true if the choice is Yes.

"No" is the default choice, set default_yes to true for "Yes" as default choice.

## `shell_isset`

## `echo_info`
```ab
pub fun shell_isset(name: Text): Bool
pub fun echo_info(message: Text): Null
```

Checks if a variable inside the shell session exists.
Prints a text as a info message.


## `shell_constant_set`
## `echo_success`
```ab
pub fun shell_constant_set(name: Text, val: Text): Null ?
pub fun echo_success(message: Text): Null
```

Sets a constant inside the shell session.
Prints a text as a success message.


## `shell_constant_get`
## `echo_warning`
```ab
pub fun shell_constant_get(name: Text): Text ?
pub fun echo_warning(message: Text): Null
```

Gets a constant inside the shell session.
Prints a text as a warning message.


## `shell_var_set`
## `error`
```ab
pub fun shell_var_set(name: Text, val: Text): Null ?
pub fun error(message: Text, exit_code: Num = 1): Null
```

Sets a constant inside the shell session.
Prints a text as a error and exits if the status code is greater than 0.


## `shell_var_get`
## `exit`
```ab
pub fun shell_var_get(name: Text): Text ?
pub fun exit(code: Num): Null
```

Gets a constant inside the shell session.
Closes the script.


## `shell_unset`
## `get_env_var`
```ab
pub fun shell_unset(name: Text): Null ?
pub fun get_env_var(var: Text, file: Text = ".env"): Text
```

Removes a variable inside the shell session.
Retrieves the value of an environment variable, optionally sourcing it from a file if not already set.


## `is_command`
## `has_failed`
```ab
pub fun is_command(command: Text): Bool
pub fun has_failed(command: Text): Bool
```

Checks if a command exists.
Checks if the command has failed.


## `input`
Expand All @@ -78,38 +80,28 @@ pub fun input(prompt: Text): Text
Creates a prompt and returns the value.


## `confirm`
```ab
pub fun confirm(prompt: Text, default_yes: Bool = false): Bool
```

Creates a confirm prompt (Yes/No), and returns true if the choice is Yes.

"No" is the default choice, set default_yes to true for "Yes" as default choice.


## `has_failed`
## `is_command`
```ab
pub fun has_failed(command: Text): Bool
pub fun is_command(command: Text): Bool
```

Checks if the command has failed.
Checks if a command exists.


## `exit`
## `is_root`
```ab
pub fun exit(code: Num): Null
pub fun is_root(): Bool
```

Closes the script.
Checks if the script is running with a user with root permission.


## `is_root`
## `load_env_file`
```ab
pub fun is_root(): Bool
pub fun load_env_file(file: Text = ".env"): Null
```

Checks if the script is running with a user with root permission.
Loads the env file in the environment, using `xargs`.


## `printf`
Expand All @@ -128,75 +120,83 @@ pub fun printf_escape(text: Text): Text
Escapes the text to be used with `printf`.


## `text_shell`
## `shell_constant_get`
```ab
pub fun text_shell(message: Text, style: Num, fg: Num, bg: Num): Text
pub fun shell_constant_get(name: Text): Text ?
```

Prepares a text with formatting options for `printf`.
Gets a constant inside the shell session.


## `text_bold`
## `shell_constant_set`
```ab
pub fun text_bold(message: Text): Text
pub fun shell_constant_set(name: Text, val: Text): Null ?
```

Returns a text as bold.
Sets a constant inside the shell session.


## `text_italic`
## `shell_isset`
```ab
pub fun text_italic(message: Text): Text
pub fun shell_isset(name: Text): Bool
```

Returns a text as italic.
Checks if a variable inside the shell session exists.


## `text_underlined`
## `shell_unset`
```ab
pub fun text_underlined(message: Text): Text
pub fun shell_unset(name: Text): Null ?
```

Returns a text as underlined.
Removes a variable inside the shell session.


## `color_echo`
## `shell_var_get`
```ab
pub fun color_echo(message: Text, color: Num): Null
pub fun shell_var_get(name: Text): Text ?
```

Prints a text with a specified color.
Gets a constant inside the shell session.


## `echo_info`
## `shell_var_set`
```ab
pub fun echo_info(message: Text): Null
pub fun shell_var_set(name: Text, val: Text): Null ?
```

Prints a text as a info message.
Sets a constant inside the shell session.


## `echo_success`
## `text_bold`
```ab
pub fun echo_success(message: Text): Null
pub fun text_bold(message: Text): Text
```

Prints a text as a success message.
Returns a text as bold.


## `echo_warning`
## `text_italic`
```ab
pub fun echo_warning(message: Text): Null
pub fun text_italic(message: Text): Text
```

Prints a text as a warning message.
Returns a text as italic.


## `error`
## `text_shell`
```ab
pub fun error(message: Text, exit_code: Num = 1): Null
pub fun text_shell(message: Text, style: Num, fg: Num, bg: Num): Text
```

Prints a text as a error and exits if the status code is greater than 0.
Prepares a text with formatting options for `printf`.


## `text_underlined`
```ab
pub fun text_underlined(message: Text): Text
```

Returns a text as underlined.


Loading

0 comments on commit e29e4c2

Please sign in to comment.