lang/sys.sh

Util functions related to the system.

sys_bash_files()

List all files in this library that start with #!/bin/bash.

Returns:

List of files in this library.

Return type:

strings

sys_function_doc()

Extract documentation for the given function.

Parameters:
  • pathf – Path to a file.

  • func – Function name.

Returns:

Documentation for the function in the file.

Return type:

strings

sys_function_doc_lines()

Compute number of doc lines for the given function.

Parameters:
  • pathf – Path to a file.

  • func – Function name.

Returns:

Number of doc lines for the function in the file.

Return type:

int

sys_functions()

List all functions in this library (excluding test files).

Returns:

List of functions in this library.

Return type:

strings

sys_functions_in_file()

List all functions in the given file.

Parameters:

pathf – Path to a file.

Returns:

List of functions in the file.

Return type:

strings

sys_gc()

Clean things allocated by this library instance.

sys_has_connection()

Return 0 if there is connection to the web; 1 otherwise.

Returns:

true/0 if there is connection to the web; false/1 otherwise.

Return type:

bool

sys_is_on_stack()

Check if the function name is on stack.

Parameters:

name – Name of a function.

Returns:

true/0 if function is on stack; false/1 otherwise

Return type:

bool

sys_line_next()

Return content of the line after the one from which this function is invoked.

Returns:

Line after the one from which this function is invoked.

Return type:

string

sys_line_num()

Return line number from which this func was called.

Returns:

Line number from which this function was called.

Return type:

int

sys_line_prev()

Return content of the line before the one from which this function is invoked.

Returns:

Line before the one from which this function is invoked.

Return type:

string

sys_repo_path()

Return the root dir for this repository.

Returns:

Root directory for this repository.

Return type:

string

sys_stack_trace()

Print stack trace.

Returns:

Stack trace.

Return type:

strings

sys_version()

Return gobash version.

Returns:

gobash version.

Return type:

string