Environment

bold

import { bold } from "std/env"
pub fun bold(message: Text): Text

Returns a text as bold.

You can check the original tests for code examples:

echo_colored

import { echo_colored } from "std/env"
pub fun echo_colored(message: Text, color: Num): Null

Prints a text with a specified color.

You can check the original tests for code examples:

echo_error

import { echo_error } from "std/env"
pub fun echo_error(message: Text, exit_code: Num = 1): Null

Prints a text as a error and exits if the status code is greater than 0.

You can check the original tests for code examples:

echo_info

import { echo_info } from "std/env"
pub fun echo_info(message: Text): Null

Prints a text as a info message.

You can check the original tests for code examples:

echo_success

import { echo_success } from "std/env"
pub fun echo_success(message: Text): Null

Prints a text as a success message.

You can check the original tests for code examples:

echo_warning

import { echo_warning } from "std/env"
pub fun echo_warning(message: Text): Null

Prints a text as a warning message.

You can check the original tests for code examples:

env_const_get

import { env_const_get } from "std/env"
pub fun env_const_get(name: Text): Text ?

Gets a constant inside the shell session.

You can check the original tests for code examples:

env_const_set

import { env_const_set } from "std/env"
pub fun env_const_set(name: Text, val: Text): Null ?

Sets a constant inside the shell session.

You can check the original tests for code examples:

env_file_load

import { env_file_load } from "std/env"
pub fun env_file_load(file: Text = ".env"): Null

Loads the env file in the environment, using xargs.

You can check the original tests for code examples:

env_var_get

import { env_var_get } from "std/env"
pub fun env_var_get(name: Text): Text ?

Gets a constant inside the shell session.

You can check the original tests for code examples:

env_var_load

import { env_var_load } from "std/env"
pub fun env_var_load(var: Text, file: Text = ".env"): Text

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

You can check the original tests for code examples:

env_var_set

import { env_var_set } from "std/env"
pub fun env_var_set(name: Text, val: Text): Null ?

Sets a constant inside the shell session.

You can check the original tests for code examples:

env_var_test

import { env_var_test } from "std/env"
pub fun env_var_test(name: Text): Bool

Checks if a variable inside the shell session exists.

You can check the original tests for code examples:

env_var_unset

import { env_var_unset } from "std/env"
pub fun env_var_unset(name: Text): Null ?

Removes a variable inside the shell session.

You can check the original tests for code examples:

escaped

import { escaped } from "std/env"
pub fun escaped(text: Text): Text

Escapes the text to be used with printf.

You can check the original tests for code examples:

has_failed

import { has_failed } from "std/env"
pub fun has_failed(command: Text): Bool

Checks if the command has failed.

You can check the original tests for code examples:

input_confirm

import { input_confirm } from "std/env"
pub fun input_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.

You can check the original tests for code examples:

input_hidden

import { input_hidden } from "std/env"
pub fun input_hidden(prompt: Text): Text

Creates a prompt, hides any user input and returns the value.

You can check the original tests for code examples:

input_prompt

import { input_prompt } from "std/env"
pub fun input_prompt(prompt: Text): Text

Creates a prompt and returns the value.

You can check the original tests for code examples:

is_command

import { is_command } from "std/env"
pub fun is_command(command: Text): Bool

Checks if a command exists.

You can check the original tests for code examples:

is_root

import { is_root } from "std/env"
pub fun is_root(): Bool

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

You can check the original tests for code examples:

italic

import { italic } from "std/env"
pub fun italic(message: Text): Text

Returns a text as italic.

You can check the original tests for code examples:

printf

import { printf } from "std/env"
pub fun printf(format: Text, args: [Text] = [""]): Null

printf the text following the arguments.

You can check the original tests for code examples:

styled

import { styled } from "std/env"
pub fun styled(message: Text, style: Num, fg: Num, bg: Num): Text

Prepares a text with formatting options for printf.

You can check the original tests for code examples:

underlined

import { underlined } from "std/env"
pub fun underlined(message: Text): Text

Returns a text as underlined.

You can check the original tests for code examples: