diff --git a/docs/commands/all.md b/docs/commands/all.md new file mode 100644 index 0000000000..260d780468 --- /dev/null +++ b/docs/commands/all.md @@ -0,0 +1,25 @@ +# all? +Find if the table rows matches the condition. + +## Usage +```shell +> all? {flags} + ``` + +## Parameters +* `` the condition that must match + +## Flags +* -h, --help: Display this help message + +## Examples + Find if services are running +```shell +> echo [[status]; [UP] [UP]] | all? status == UP + ``` + + Check that all values are even +```shell +> echo [2 4 6 8] | all? ($it mod 2) == 0 + ``` + diff --git a/docs/commands/ansi-strip.md b/docs/commands/ansi-strip.md new file mode 100644 index 0000000000..ec1d082c81 --- /dev/null +++ b/docs/commands/ansi-strip.md @@ -0,0 +1,20 @@ +# ansi strip +strip ansi escape sequences from string + +## Usage +```shell +> ansi strip ...args {flags} + ``` + +## Parameters +* ...args: optionally, remove ansi sequences by column paths + +## Flags +* -h, --help: Display this help message + +## Examples + strip ansi escape sequences from string +```shell +> echo [(ansi gb) 'hello' (ansi reset)] | str collect | ansi strip + ``` + diff --git a/docs/commands/ansi.md b/docs/commands/ansi.md new file mode 100644 index 0000000000..4256846be7 --- /dev/null +++ b/docs/commands/ansi.md @@ -0,0 +1,88 @@ +# ansi +Output ANSI codes to change color. + +For escape sequences: +Escape: `\x1b[` is not required for --escape parameter + +Format: `#(;#)m` + +Example: 1;31m for bold red or 2;37;41m for dimmed white fg with red bg +There can be multiple text formatting sequence numbers +separated by a ; and ending with an m where the # is of the +following values: + +attributes +* 0 reset / normal display +* 1 bold or increased intensity +* 2 faint or decreased intensity +* 3 italic on (non-mono font) +* 4 underline on +* 5 slow blink on +* 6 fast blink on +* 7 reverse video on +* 8 nondisplayed (invisible) on +* 9 strike-through on + +``` + foreground/bright colors background/bright colors + 30/90 black 40/100 black + 31/91 red 41/101 red + 32/92 green 42/102 green + 33/93 yellow 43/103 yellow + 34/94 blue 44/104 blue + 35/95 magenta 45/105 magenta + 36/96 cyan 46/106 cyan + 37/97 white 47/107 white + https://en.wikipedia.org/wiki/ANSI_escape_code +``` +OSC: `\x1b]` is not required for --osc parameter + +Example: `echo [(ansi -o '0') 'some title' (char bel)] | str collect` + +Format: +* 0 Set window title and icon name +* 1 Set icon name +* 2 Set window title +* 4 Set/read color palette +* 9 iTerm2 Grown notifications +* 10 Set foreground color (x11 color spec) +* 11 Set background color (x11 color spec) +* ... others + +## Usage +```shell +> ansi (code) {flags} + ``` + +## Subcommands +* ansi strip - strip ansi escape sequences from string + +## Parameters +* `(code)` the name of the code to use like 'green' or 'reset' to reset the color + +## Flags +* -h, --help: Display this help message +* -e, --escape : escape sequence without the escape character(s) +* -o, --osc : operating system command (ocs) escape sequence without the escape character(s) + +## Examples + Change color to green +```shell +> ansi green + ``` + + Reset the color +```shell +> ansi reset + ``` + + Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold) +```shell +> echo [(ansi rb) Hello " " (ansi gb) Nu " " (ansi pb) World] | str collect + ``` + + Use ansi to color text (rb = red bold, gb = green bold, pb = purple bold) +```shell +> echo [(ansi -e '3;93;41m') Hello (ansi reset) " " (ansi gb) Nu " " (ansi pb) World] | str collect + ``` + diff --git a/docs/commands/any.md b/docs/commands/any.md new file mode 100644 index 0000000000..fbb41e1141 --- /dev/null +++ b/docs/commands/any.md @@ -0,0 +1,25 @@ +# any? +Find if the table rows matches the condition. + +## Usage +```shell +> any? {flags} + ``` + +## Parameters +* `` the condition that must match + +## Flags +* -h, --help: Display this help message + +## Examples + Find if a service is not running +```shell +> echo [[status]; [UP] [DOWN] [UP]] | any? status == DOWN + ``` + + Check if any of the values is odd +```shell +> echo [2 4 1 6 8] | any? ($it mod 2) == 1 + ``` + diff --git a/docs/commands/autoenv-trust.md b/docs/commands/autoenv-trust.md new file mode 100644 index 0000000000..a6500abfbc --- /dev/null +++ b/docs/commands/autoenv-trust.md @@ -0,0 +1,25 @@ +# autoenv trust +Trust a .nu-env file in the current or given directory + +## Usage +```shell +> autoenv trust (dir) {flags} + ``` + +## Parameters +* `(dir)` Directory to allow + +## Flags +* -h, --help: Display this help message + +## Examples + Allow .nu-env file in current directory +```shell +> autoenv trust + ``` + + Allow .nu-env file in directory foo +```shell +> autoenv trust foo + ``` + diff --git a/docs/commands/autoenv-untrust.md b/docs/commands/autoenv-untrust.md new file mode 100644 index 0000000000..29085b6341 --- /dev/null +++ b/docs/commands/autoenv-untrust.md @@ -0,0 +1,25 @@ +# autoenv untrust +Untrust a .nu-env file in the current or given directory + +## Usage +```shell +> autoenv untrust (dir) {flags} + ``` + +## Parameters +* `(dir)` Directory to disallow + +## Flags +* -h, --help: Display this help message + +## Examples + Disallow .nu-env file in current directory +```shell +> autoenv untrust + ``` + + Disallow .nu-env file in directory foo +```shell +> autoenv untrust foo + ``` + diff --git a/docs/commands/autoenv.md b/docs/commands/autoenv.md new file mode 100644 index 0000000000..b71b758077 --- /dev/null +++ b/docs/commands/autoenv.md @@ -0,0 +1,34 @@ +# autoenv +Manage directory specific environment variables and scripts. + +Create a file called .nu-env in any directory and run 'autoenv trust' to let nushell load it when entering the directory. +The .nu-env file has the same format as your $HOME/nu/config.toml file. By loading a .nu-env file the following applies: + * - environment variables (section \"[env]\") are loaded from the .nu-env file. Those env variables only exist in this directory (and children directories) + * - the \"startup\" commands are run when entering the directory + * - the \"on_exit\" commands are run when leaving the directory + + +## Usage +```shell +> autoenv {flags} + ``` + +## Subcommands +* autoenv trust - Trust a .nu-env file in the current or given directory +* autoenv untrust - Untrust a .nu-env file in the current or given directory + +## Flags +* -h, --help: Display this help message + +## Examples + Example .nu-env file +```shell +> cat .nu-env + ``` + startup = ["echo ...entering the directory", "echo 1 2 3"] + on_exit = ["echo ...leaving the directory"] + + [env] + mykey = "myvalue" + + diff --git a/docs/commands/benchmark.md b/docs/commands/benchmark.md new file mode 100644 index 0000000000..1cca60fac2 --- /dev/null +++ b/docs/commands/benchmark.md @@ -0,0 +1,26 @@ +# benchmark +Runs a block and returns the time it took to execute it. + +## Usage +```shell +> benchmark {flags} + ``` + +## Parameters +* `` the block to run and benchmark + +## Flags +* -h, --help: Display this help message +* -p, --passthrough : Display the benchmark results and pass through the block's output + +## Examples + Benchmarks a command within a block +```shell +> benchmark { sleep 500ms } + ``` + + Benchmarks a command within a block and passes its output through +```shell +> echo 45 | benchmark { sleep 500ms } --passthrough {} + ``` + diff --git a/docs/commands/binaryview.md b/docs/commands/binaryview.md new file mode 100644 index 0000000000..e3f539bae5 --- /dev/null +++ b/docs/commands/binaryview.md @@ -0,0 +1,14 @@ +# binaryview +Autoview of binary data. + +## Usage +```shell +> binaryview {flags} + ``` + +## Flags +* -h, --help: Display this help message +* -l, --lores: use low resolution output mode +* -s, --skip : skip x number of bytes +* -b, --bytes : show y number of bytes + diff --git a/docs/commands/build-string.md b/docs/commands/build-string.md new file mode 100644 index 0000000000..95d5ae5c67 --- /dev/null +++ b/docs/commands/build-string.md @@ -0,0 +1,20 @@ +# build-string +Builds a string from the arguments. + +## Usage +```shell +> build-string ...args {flags} + ``` + +## Parameters +* ...args: all values to form into the string + +## Flags +* -h, --help: Display this help message + +## Examples + Builds a string from a string and a number, without spaces between them +```shell +> build-string 'foo' 3 + ``` + diff --git a/docs/commands/char.md b/docs/commands/char.md new file mode 100644 index 0000000000..d785b2f61c --- /dev/null +++ b/docs/commands/char.md @@ -0,0 +1,38 @@ +# char +Output special characters (e.g., 'newline'). + +## Usage +```shell +> char (character) ...args {flags} + ``` + +## Parameters +* `(character)` the name of the character to output +* ...args: multiple Unicode bytes + +## Flags +* -h, --help: Display this help message +* -l, --list: List all supported character names +* -u, --unicode: Unicode string i.e. 1f378 + +## Examples + Output newline +```shell +> char newline + ``` + + Output prompt character, newline and a hamburger character +```shell +> echo (char prompt) (char newline) (char hamburger) + ``` + + Output Unicode character +```shell +> char -u 1f378 + ``` + + Output multi-byte Unicode character +```shell +> char -u 1F468 200D 1F466 200D 1F466 + ``` + diff --git a/docs/commands/chart-bar.md b/docs/commands/chart-bar.md new file mode 100644 index 0000000000..05ce1d44a5 --- /dev/null +++ b/docs/commands/chart-bar.md @@ -0,0 +1,17 @@ +# chart bar +Bar charts + +## Usage +```shell +> chart bar (columns) {flags} + ``` + +## Parameters +* `(columns)` the columns to chart [x-axis y-axis] + +## Flags +* -h, --help: Display this help message +* -a, --acc: accumulate values +* -u, --use : column to use for evaluation +* -f, --format : Specify date and time formatting + diff --git a/docs/commands/chart-line.md b/docs/commands/chart-line.md new file mode 100644 index 0000000000..8daf77d9b2 --- /dev/null +++ b/docs/commands/chart-line.md @@ -0,0 +1,17 @@ +# chart line +Line charts + +## Usage +```shell +> chart line (columns) {flags} + ``` + +## Parameters +* `(columns)` the columns to chart [x-axis y-axis] + +## Flags +* -h, --help: Display this help message +* -a, --acc: accumulate values +* -u, --use : column to use for evaluation +* -f, --format : Specify date and time formatting + diff --git a/docs/commands/chart.md b/docs/commands/chart.md new file mode 100644 index 0000000000..2c6f93a8b9 --- /dev/null +++ b/docs/commands/chart.md @@ -0,0 +1,15 @@ +# chart +Displays charts. + +## Usage +```shell +> chart {flags} + ``` + +## Subcommands +* chart bar - Bar charts +* chart line - Line charts + +## Flags +* -h, --help: Display this help message + diff --git a/docs/commands/clear.md b/docs/commands/clear.md new file mode 100644 index 0000000000..83eb485256 --- /dev/null +++ b/docs/commands/clear.md @@ -0,0 +1,17 @@ +# clear +Clears the terminal. + +## Usage +```shell +> clear {flags} + ``` + +## Flags +* -h, --help: Display this help message + +## Examples + Clear the screen +```shell +> clear + ``` + diff --git a/docs/commands/clip.md b/docs/commands/clip.md new file mode 100644 index 0000000000..e13735d408 --- /dev/null +++ b/docs/commands/clip.md @@ -0,0 +1,22 @@ +# clip +Copy the contents of the pipeline to the copy/paste buffer. + +## Usage +```shell +> clip {flags} + ``` + +## Flags +* -h, --help: Display this help message + +## Examples + Save text to the clipboard +```shell +> echo 'secret value' | clip + ``` + + Save numbers to the clipboard +```shell +> random integer 10000000..99999999 | clip + ``` + diff --git a/docs/commands/config-clear.md b/docs/commands/config-clear.md new file mode 100644 index 0000000000..1709748074 --- /dev/null +++ b/docs/commands/config-clear.md @@ -0,0 +1,17 @@ +# config clear +clear the config + +## Usage +```shell +> config clear {flags} + ``` + +## Flags +* -h, --help: Display this help message + +## Examples + Clear the config (be careful!) +```shell +> config clear + ``` + diff --git a/docs/commands/config-get.md b/docs/commands/config-get.md new file mode 100644 index 0000000000..3cec20ba38 --- /dev/null +++ b/docs/commands/config-get.md @@ -0,0 +1,20 @@ +# config get +Gets a value from the config + +## Usage +```shell +> config get {flags} + ``` + +## Parameters +* `` value to get from the config + +## Flags +* -h, --help: Display this help message + +## Examples + Get the current startup commands +```shell +> config get startup + ``` + diff --git a/docs/commands/config-path.md b/docs/commands/config-path.md new file mode 100644 index 0000000000..6e720546aa --- /dev/null +++ b/docs/commands/config-path.md @@ -0,0 +1,17 @@ +# config path +return the path to the config file + +## Usage +```shell +> config path {flags} + ``` + +## Flags +* -h, --help: Display this help message + +## Examples + Get the path to the current config file +```shell +> config path + ``` + diff --git a/docs/commands/config-remove.md b/docs/commands/config-remove.md new file mode 100644 index 0000000000..da1170cace --- /dev/null +++ b/docs/commands/config-remove.md @@ -0,0 +1,20 @@ +# config remove +Removes a value from the config + +## Usage +```shell +> config remove {flags} + ``` + +## Parameters +* `` remove a value from the config + +## Flags +* -h, --help: Display this help message + +## Examples + Remove the startup commands +```shell +> config remove startup + ``` + diff --git a/docs/commands/config-set.md b/docs/commands/config-set.md new file mode 100644 index 0000000000..75e8505e39 --- /dev/null +++ b/docs/commands/config-set.md @@ -0,0 +1,36 @@ +# config set +Sets a value in the config + +## Usage +```shell +> config set {flags} + ``` + +## Parameters +* `` variable name to set +* `` value to use + +## Flags +* -h, --help: Display this help message + +## Examples + Set auto pivoting +```shell +> config set pivot_mode always + ``` + + Set line editor options +```shell +> config set line_editor [[edit_mode, completion_type]; [emacs circular]] + ``` + + Set coloring options +```shell +> config set color_config [[header_align header_bold]; [left $true]] + ``` + + Set nested options +```shell +> config set color_config.header_color white + ``` + diff --git a/docs/commands/config-set_into.md b/docs/commands/config-set_into.md new file mode 100644 index 0000000000..f488052876 --- /dev/null +++ b/docs/commands/config-set_into.md @@ -0,0 +1,20 @@ +# config set_into +Sets a value in the config + +## Usage +```shell +> config set_into {flags} + ``` + +## Parameters +* `` sets a variable from values in the pipeline + +## Flags +* -h, --help: Display this help message + +## Examples + Store the contents of the pipeline as a path +```shell +> echo ['/usr/bin' '/bin'] | config set_into path + ``` + diff --git a/docs/commands/cp.md b/docs/commands/cp.md new file mode 100644 index 0000000000..7e658072ec --- /dev/null +++ b/docs/commands/cp.md @@ -0,0 +1,27 @@ +# cp +Copy files. + +## Usage +```shell +> cp {flags} + ``` + +## Parameters +* `` the place to copy from +* `` the place to copy to + +## Flags +* -h, --help: Display this help message +* -r, --recursive: copy recursively through subdirectories + +## Examples + Copy myfile to dir_b +```shell +> cp myfile dir_b + ``` + + Recursively copy dir_a to dir_b +```shell +> cp -r dir_a dir_b + ``` + diff --git a/docs/commands/date-format.md b/docs/commands/date-format.md new file mode 100644 index 0000000000..d991881550 --- /dev/null +++ b/docs/commands/date-format.md @@ -0,0 +1,26 @@ +# date format +Format a given date using the given format string. + +## Usage +```shell +> date format {flags} + ``` + +## Parameters +* `` strftime format + +## Flags +* -h, --help: Display this help message +* -t, --table: print date in a table + +## Examples + Format the current date +```shell +> date now | date format '%Y.%m.%d_%H %M %S,%z' + ``` + + Format the current date and print in a table +```shell +> date now | date format -t '%Y-%m-%d_%H:%M:%S %z' + ``` + diff --git a/docs/commands/date-list-timezone.md b/docs/commands/date-list-timezone.md new file mode 100644 index 0000000000..9d25161b8f --- /dev/null +++ b/docs/commands/date-list-timezone.md @@ -0,0 +1,22 @@ +# date list-timezone +List supported time zones. + +## Usage +```shell +> date list-timezone {flags} + ``` + +## Flags +* -h, --help: Display this help message + +## Examples + List all supported time zones +```shell +> date list-timezone + ``` + + List all supported European time zones +```shell +> date list-timezone | where timezone =~ Europe + ``` + diff --git a/docs/commands/date-now.md b/docs/commands/date-now.md new file mode 100644 index 0000000000..54b24c5f78 --- /dev/null +++ b/docs/commands/date-now.md @@ -0,0 +1,11 @@ +# date now +Get the current date. + +## Usage +```shell +> date now {flags} + ``` + +## Flags +* -h, --help: Display this help message + diff --git a/docs/commands/date-to-table.md b/docs/commands/date-to-table.md new file mode 100644 index 0000000000..268d23163d --- /dev/null +++ b/docs/commands/date-to-table.md @@ -0,0 +1,17 @@ +# date to-table +Print the date in a structured table. + +## Usage +```shell +> date to-table {flags} + ``` + +## Flags +* -h, --help: Display this help message + +## Examples + Print the current date in a table +```shell +> date now | date to-table + ``` + diff --git a/docs/commands/date-to-timezone.md b/docs/commands/date-to-timezone.md new file mode 100644 index 0000000000..f33addf37d --- /dev/null +++ b/docs/commands/date-to-timezone.md @@ -0,0 +1,32 @@ +# date to-timezone +Convert a date to a given time zone. + +Use 'date list-timezone' to list all supported time zones. + +## Usage +```shell +> date to-timezone