Skip to content

Latest commit

 

History

History
271 lines (256 loc) · 10.8 KB

GUIDE.builtin-functions.md

File metadata and controls

271 lines (256 loc) · 10.8 KB

murex Shell Docs

Command Reference

This section is a glossary of murex builtin commands.

Because murex is loosely modelled on the functional paradigm, it means all language constructs are exposed via functions and those are typically builtins because they can share the murex runtime virtual machine. However any executable command can also be called from within murex; be that either via the exec builtin or natively like you would from any Linux, UNIX, or even Windows command prompt.

Other Reference Material

Language Guides

  1. GUIDE.control-structures, which contains builtins required for building logic.

murex's Source Code

In murex's source under the lang/builtins path of the project files is several directories, each hosting different categories of murex builtins. From core commands through to data-types and methods.

Each package will include a README.md file with a basic summary of what that package is used for and all you to enable or disable builtins, should you decide to compile the shell from source.

Shell Commands For Querying Builtins

From the shell itself: run builtins to list the builtin command.

If you require a manual on any of those commands, you can run murex-docs to return the same markdown-formatted document as those listed below. eg

murex-docs trypipe

Pages

  • ! (not): Reads the STDIN and exit number from previous process and not's it's condition
  • ( (brace quote): Write a string to the STDOUT without new line
  • 2darray : Create a 2D JSON array from multiple input sources
  • <> / read-named-pipe: Reads from a murex named pipe
  • <stdin> : Read the STDIN belonging to the parent code block
  • = (arithmetic evaluation): Evaluate a mathematical function
  • >> (append file): Writes STDIN to disk - appending contents if file already exists
  • > (truncate file): Writes STDIN to disk - overwriting contents if file already exists
  • @[ (range) : Outputs a ranged subset of data from STDIN
  • [[ (element): Outputs an element from a nested structure
  • [ (index): Outputs an element from an array, map or table
  • a (mkarray): A sophisticated yet simple way to build an array or list
  • addheading : Adds headings to a table
  • alias: Create an alias for a command
  • alter: Change a value within a structured data-type and pass that change along the pipeline without altering the original source input
  • and: Returns true or false depending on whether multiple conditions are met
  • append: Add data to the end of an array
  • args : Command line flag parser for murex shell scripting
  • autocomplete: Set definitions for tab-completion in the command line
  • bexists: Check which builtins exist
  • bg: Run processes in the background
  • cast: Alters the data type of the previous function without altering it's output
  • catch: Handles the exception code raised by try or trypipe
  • cd: Change (working) directory
  • config: Query or define murex runtime settings
  • count: Count items in a map, list or array
  • cpuarch: Output the hosts CPU architecture
  • cpucount: Output the number of CPU cores available on your host
  • datetime : A date and/or time conversion tool (like printf but for date and time values)
  • debug: Debugging information
  • die: Terminate murex with an exit number of 1
  • err: Print a line to the STDERR
  • escape: Escape or unescape input
  • esccli: Escapes an array so output is valid shell code
  • eschtml: Encode or decodes text for HTML
  • escurl: Encode or decodes text for the URL
  • event: Event driven programming for shell scripts
  • exec: Runs an executable
  • exit: Exit murex
  • exitnum: Output the exit number of the previous process
  • export: Define an environmental variable and set it's value
  • f: Lists objects (eg files) in the current working directory
  • false: Returns a false value
  • fexec : Execute a command or function, bypassing the usual order of precedence.
  • fg: Sends a background process into the foreground
  • fid-kill: Terminate a running murex function
  • fid-killall: Terminate all running murex functions
  • fid-list: Lists all running functions within the current murex session
  • for: A more familiar iteration loop to existing developers
  • foreach: Iterate through an array
  • formap: Iterate through a map or other collection of data
  • format: Reformat one data-type into another data-type
  • function: Define a function block
  • g: Glob pattern matching for file system objects (eg *.txt)
  • get-type: Returns the data-type of a variable or pipe
  • get: Makes a standard HTTP request and returns the result as a JSON object
  • getfile: Makes a standard HTTP request and return the contents as murex-aware data type for passing along murex pipelines.
  • global: Define a global variable and set it's value
  • history: Outputs murex's command history
  • if: Conditional statement to execute different blocks of code depending on the result of the condition
  • ja (mkarray): A sophisticated yet simply way to build a JSON array
  • jsplit : Splits STDIN into a JSON array based on a regex parameter
  • left: Left substring every item in a list
  • let: Evaluate a mathematical function and assign to variable
  • lockfile: Create and manage lock files
  • man-summary: Outputs a man page summary of a command
  • map : Creates a map from two data sources
  • match: Match an exact value in an array
  • method: Define a methods supported data-types
  • msort : Sorts an array - data type agnostic
  • mtac: Reverse the order of an array
  • murex-docs: Displays the man pages for murex builtins
  • murex-package: murex's package manager
  • murex-parser : Runs the murex parser against a block of code
  • murex-update-exe-list: Forces murex to rescan $PATH looking for exectables
  • null: null function. Similar to /dev/null
  • open-image : Renders bitmap image data on your terminal
  • open: Open a file with a preferred handler
  • openagent: Creates a handler function for `open
  • or: Returns true or false depending on whether one code-block out of multiple ones supplied is successful or unsuccessful.
  • os: Output the auto-detected OS name
  • out: Print a string to the STDOUT with a trailing new line character
  • pipe: Manage murex named pipes
  • post: HTTP POST request with a JSON-parsable return
  • prefix: Prefix a string to every item in a list
  • prepend : Add data to the start of an array
  • pretty: Prettifies JSON to make it human readable
  • private: Define a private function block
  • pt: Pipe telemetry. Writes data-types and bytes written
  • rand: Random field generator
  • read: read a line of input from the user and store as a variable
  • regexp: Regexp tools for arrays / lists of strings
  • right: Right substring every item in a list
  • runtime: Returns runtime information on the internal state of murex
  • rx: Regexp pattern matching for file system objects (eg '.*.txt')
  • set: Define a local variable and set it's value
  • source : Import murex code from another file of code block
  • struct-keys: Outputs all the keys in a structure as a file path
  • suffix: Prefix a string to every item in a list
  • summary : Defines a summary help text for a command
  • switch: Blocks of cascading conditionals
  • swivel-datatype: Converts tabulated data into a map of values for serialised data-types such as JSON and YAML
  • swivel-table: Rotates a table by 90 degrees
  • ta (mkarray): A sophisticated yet simple way to build an array of a user defined data-type
  • tabulate: Table transformation tools
  • test: murex's test framework - define tests, run tests and debug shell scripts
  • time : Returns the execution run time of a command or block
  • tmp: Create a temporary file and write to it
  • tout: Print a string to the STDOUT and set it's data-type
  • tread: read a line of input from the user and store as a user defined typed variable
  • true: Returns a true value
  • try: Handles errors inside a block of code
  • trypipe: Checks state of each function in a pipeline and exits block on error
  • version : Get murex version
  • while: Loop until condition false