Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refresh command docs for Nu v0.88 #1171

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refresh command docs for Nu v0.88
  • Loading branch information
hustcer committed Dec 13, 2023
commit 9cbd916fd1c9f737dc6d1ba44d6246b115ef8084
10 changes: 5 additions & 5 deletions commands/docs/dfr_datepart.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ Creates an expression to capture multiple date parts
(dfr col datetime | dfr datepart minute | dfr as datetime_minute ),
(dfr col datetime | dfr datepart second | dfr as datetime_second ),
(dfr col datetime | dfr datepart nanosecond | dfr as datetime_ns ) ]
╭───┬─────────────┬───────────────┬────────────────┬──────────────┬───────────────┬─────────────────┬─────────────────┬─────╮
# │ datetime │ datetime_year │ datetime_month │ datetime_day │ datetime_hour │ datetime_minute │ datetime_second │ ...
├───┼─────────────┼───────────────┼────────────────┼──────────────┼───────────────┼─────────────────┼─────────────────┼─────┤
0 │ 2 years ago │ 2021 │ 12 │ 30 │ 1 │ 2 │ 3 │ ...
╰───┴─────────────┴───────────────┴────────────────┴──────────────┴───────────────┴─────────────────┴─────────────────┴─────╯
╭───┬─────────────┬───────────────┬────────────────┬──────────────┬───────────────┬─────────────────┬─────────────────┬─────────────╮
│ # │ datetime │ datetime_year │ datetime_month │ datetime_day │ datetime_hour │ datetime_minute │ datetime_second │ datetime_ns
├───┼─────────────┼───────────────┼────────────────┼──────────────┼───────────────┼─────────────────┼─────────────────┼─────────────┤
│ 0 │ 2 years ago │ 2021 │ 12 │ 30 │ 1 │ 2 │ 3 │ 123456789
╰───┴─────────────┴───────────────┴────────────────┴──────────────┴───────────────┴─────────────────┴─────────────────┴─────────────╯

```

Expand Down
10 changes: 5 additions & 5 deletions commands/docs/from_ics.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Converts ics formatted string to table
```nu
> 'BEGIN:VCALENDAR
END:VCALENDAR' | from ics
╭────┬─────────────────┬────────────────┬────────────────┬────────────────┬────────────────┬────────────────┬────────────────╮
# │ properties │ events │ alarms │ to-Dos │ journals │ free-busys │ timezones │
├────┼─────────────────┼────────────────┼────────────────┼────────────────┼────────────────┼────────────────┼────────────────┤
0 │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │
╰────┴─────────────────┴────────────────┴────────────────┴────────────────┴────────────────┴────────────────┴────────────────╯
╭───────────────────┬────────────────┬────────────────┬────────────────┬────────────────┬────────────────┬────────────────╮
│ # │ properties │ events │ alarms │ to-Dos │ journals │ free-busys │ timezones │
├───────────────────┼────────────────┼────────────────┼────────────────┼────────────────┼────────────────┼────────────────┤
│ 0 │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │ [list 0 items] │
╰───────────────────┴────────────────┴────────────────┴────────────────┴────────────────┴────────────────┴────────────────╯

```
12 changes: 6 additions & 6 deletions commands/docs/histogram.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ Compute a histogram for the types of files, with frequency column named freq
Compute a histogram for a list of numbers
```nu
> [1 2 1] | histogram
╭─────┬─────────┬─────────┬────────────┬──────────────┬──────────────────────────────────────────────────────────────────────╮
# │ value count quantile percentage frequency
├─────┼─────────┼─────────┼────────────┼──────────────┼──────────────────────────────────────────────────────────────────────┤
0 │ 1 │ 2 │ 0.67 │ 66.67% │ ******************************************************************
1 │ 2 │ 1 │ 0.33 │ 33.33% │ *********************************
╰─────┴─────────┴─────────┴────────────┴──────────────┴──────────────────────────────────────────────────────────────────────╯
╭───┬───────┬───────┬──────────┬────────────────────────────────────────────────────────────────────────────────╮
│ # │ value count quantile percentage │ frequency │
├───┼───────┼───────┼──────────┼────────────────────────────────────────────────────────────────────────────────┤
│ 0 │ 1 │ 2 │ 0.67 │ 66.67% │ ****************************************************************** │
│ 1 │ 2 │ 1 │ 0.33 │ 33.33% │ ********************************* │
╰───┴───────┴───────┴──────────┴────────────────────────────────────────────────────────────────────────────────╯

```

Expand Down
7 changes: 7 additions & 0 deletions commands/docs/kill.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ usage: |

- `--force, -f`: forcefully kill the process
- `--quiet, -q`: won't print anything to the console
- `--signal, -s {int}`: signal decimal number to be sent instead of the default 15 (unsupported on Windows)

## Parameters

Expand All @@ -48,3 +49,9 @@ Force kill a given pid
> kill --force 12345

```

Send INT signal
```nu
> kill -s 2 12345

```
8 changes: 4 additions & 4 deletions commands/docs/path_basename.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ usage: |

Get basename of a path
```nu
> 'C:\Users\joe\test.txt' | path basename
> '/home/joe/test.txt' | path basename
test.txt
```

Get basename of a list of paths
```nu
> [ C:\Users\joe, C:\Users\doe ] | path basename
> [ /home/joe, /home/doe ] | path basename
╭───┬─────╮
│ 0 │ joe │
│ 1 │ doe │
Expand All @@ -49,6 +49,6 @@ Get basename of a list of paths

Replace basename of a path
```nu
> 'C:\Users\joe\test.txt' | path basename --replace 'spam.png'
C:\Users\joe\spam.png
> '/home/joe/test.txt' | path basename --replace 'spam.png'
/home/joe/spam.png
```
22 changes: 11 additions & 11 deletions commands/docs/path_dirname.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,28 @@ usage: |

Get dirname of a path
```nu
> 'C:\Users\joe\code\test.txt' | path dirname
C:\Users\joe\code
> '/home/joe/code/test.txt' | path dirname
/home/joe/code
```

Get dirname of a list of paths
```nu
> [ C:\Users\joe\test.txt, C:\Users\doe\test.txt ] | path dirname
╭───┬──────────────
│ 0 │ C:\Users\joe │
│ 1 │ C:\Users\doe │
╰───┴──────────────
> [ /home/joe/test.txt, /home/doe/test.txt ] | path dirname
╭───┬───────────╮
│ 0 │ /home/joe │
│ 1 │ /home/doe │
╰───┴───────────╯

```

Walk up two levels
```nu
> 'C:\Users\joe\code\test.txt' | path dirname --num-levels 2
C:\Users\joe
> '/home/joe/code/test.txt' | path dirname --num-levels 2
/home/joe
```

Replace the part that would be returned with a custom path
```nu
> 'C:\Users\joe\code\test.txt' | path dirname --num-levels 2 --replace C:\Users\viking
C:\Users\viking\code\test.txt
> '/home/joe/code/test.txt' | path dirname --num-levels 2 --replace /home/viking
/home/viking/code/test.txt
```
4 changes: 2 additions & 2 deletions commands/docs/path_exists.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ usage: |

Check if a file exists
```nu
> 'C:\Users\joe\todo.txt' | path exists
> '/home/joe/todo.txt' | path exists
false
```

Check if files in list exist
```nu
> [ C:\joe\todo.txt, C:\Users\doe\todo.txt ] | path exists
> [ /home/joe/todo.txt, /home/doe/todo.txt ] | path exists
╭───┬───────╮
│ 0 │ false │
│ 1 │ false │
Expand Down
16 changes: 8 additions & 8 deletions commands/docs/path_expand.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ usage: |

Expand an absolute path
```nu
> 'C:\Users\joe\foo\..\bar' | path expand
C:\Users\joe\bar
> '/home/joe/foo/../bar' | path expand
/home/joe/bar
```

Expand a relative path
```nu
> 'foo\..\bar' | path expand
> 'foo/../bar' | path expand

```

Expand a list of paths
```nu
> [ C:\foo\..\bar, C:\foo\..\baz ] | path expand
╭───┬────────
│ 0 │ C:\bar │
│ 1 │ C:\baz │
╰───┴────────
> [ /foo/../bar, /foo/../baz ] | path expand
╭───┬──────╮
│ 0 │ /bar │
│ 1 │ /baz │
╰───┴──────╯

```
32 changes: 16 additions & 16 deletions commands/docs/path_join.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,46 @@ usage: |

Append a filename to a path
```nu
> 'C:\Users\viking' | path join spam.txt
C:\Users\viking\spam.txt
> '/home/viking' | path join spam.txt
/home/viking/spam.txt
```

Append a filename to a path
```nu
> 'C:\Users\viking' | path join spams this_spam.txt
C:\Users\viking\spams\this_spam.txt
> '/home/viking' | path join spams this_spam.txt
/home/viking/spams/this_spam.txt
```

Use relative paths, e.g. '..' will go up one directory
```nu
> 'C:\Users\viking' | path join .. folder
C:\Users\viking\..\folder
> '/home/viking' | path join .. folder
/home/viking/../folder
```

Use absolute paths, e.g. '/' will bring you to the top level directory
```nu
> 'C:\Users\viking' | path join / folder
C:/folder
> '/home/viking' | path join / folder
/folder
```

Join a list of parts into a path
```nu
> [ 'C:' '\' 'Users' 'viking' 'spam.txt' ] | path join
C:\Users\viking\spam.txt
> [ '/' 'home' 'viking' 'spam.txt' ] | path join
/home/viking/spam.txt
```

Join a structured path into a path
```nu
> { parent: 'C:\Users\viking', stem: 'spam', extension: 'txt' } | path join
C:\Users\viking\spam.txt
> { parent: '/home/viking', stem: 'spam', extension: 'txt' } | path join
/home/viking/spam.txt
```

Join a table of structured paths into a list of paths
```nu
> [ [parent stem extension]; ['C:\Users\viking' 'spam' 'txt']] | path join
╭───┬──────────────────────────
│ 0 │ C:\Users\viking\spam.txt │
╰───┴──────────────────────────
> [[ parent stem extension ]; [ '/home/viking' 'spam' 'txt' ]] | path join
╭───┬───────────────────────╮
│ 0 │ /home/viking/spam.txt │
╰───┴───────────────────────╯

```

Expand Down
44 changes: 21 additions & 23 deletions commands/docs/path_parse.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,41 @@ usage: |
| string | record |
## Examples

Parse a single path
Parse a path
```nu
> 'C:\Users\viking\spam.txt' | path parse
╭───────────┬─────────────────╮
│ prefix │ C: │
│ parent │ C:\Users\viking │
│ stem │ spam │
│ extension │ txt │
╰───────────┴─────────────────╯
> '/home/viking/spam.txt' | path parse
╭───────────┬──────────────╮
│ parent │ /home/viking │
│ stem │ spam │
│ extension │ txt │
╰───────────┴──────────────╯
```

Replace a complex extension
```nu
> 'C:\Users\viking\spam.tar.gz' | path parse --extension tar.gz | upsert extension { 'txt' }
> '/home/viking/spam.tar.gz' | path parse --extension tar.gz | upsert extension { 'txt' }

```

Ignore the extension
```nu
> 'C:\Users\viking.d' | path parse --extension ''
╭───────────┬──────────╮
│ prefix │ C: │
│ parent │ C:\Users │
│ stem │ viking.d │
│ extension │ │
╰───────────┴──────────╯
> '/etc/conf.d' | path parse --extension ''
╭───────────┬────────╮
│ parent │ /etc │
│ stem │ conf.d │
│ extension │ │
╰───────────┴────────╯
```

Parse all paths in a list
```nu
> [ C:\Users\viking.d C:\Users\spam.txt ] | path parse
╭───┬────────┬──────────┬────────┬───────────╮
│ # │ prefix │ parent │ stem │ extension │
├───┼────────┼──────────┼────────┼───────────┤
│ 0 │ C: │ C:\Users │ viking │ d │
│ 1 │ C: │ C:\Users │ spam │ txt │
╰───┴────────┴──────────┴────────┴───────────╯
> [ /home/viking.d /home/spam.txt ] | path parse
╭───┬────────┬────────┬───────────╮
│ # │ parent │ stem │ extension │
├───┼────────┼────────┼───────────┤
│ 0 │ /home │ viking │ d │
│ 1 │ /home │ spam │ txt │
╰───┴────────┴────────┴───────────╯

```

Expand Down
6 changes: 3 additions & 3 deletions commands/docs/path_relative-to.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ usage: |

Find a relative path from two absolute paths
```nu
> 'C:\Users\viking' | path relative-to 'C:\Users'
> '/home/viking' | path relative-to '/home'
viking
```

Find a relative path from absolute paths in list
```nu
> [ C:\Users\viking, C:\Users\spam ] | path relative-to C:\Users
> [ /home/viking, /home/spam ] | path relative-to '/home'
╭───┬────────╮
│ 0 │ viking │
│ 1 │ spam │
Expand All @@ -49,7 +49,7 @@ Find a relative path from absolute paths in list

Find a relative path from two relative paths
```nu
> 'eggs\bacon\sausage\spam' | path relative-to 'eggs\bacon\sausage'
> 'eggs/bacon/sausage/spam' | path relative-to 'eggs/bacon/sausage'
spam
```

Expand Down
16 changes: 8 additions & 8 deletions commands/docs/path_split.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ usage: |

Split a path into parts
```nu
> 'C:\Users\viking\spam.txt' | path split
> '/home/viking/spam.txt' | path split
╭───┬──────────╮
│ 0 │ C:\
│ 1 │ Users
│ 0 │ /
│ 1 │ home
│ 2 │ viking │
│ 3 │ spam.txt │
╰───┴──────────╯
Expand All @@ -41,17 +41,17 @@ Split a path into parts

Split paths in list into parts
```nu
> [ C:\Users\viking\spam.txt C:\Users\viking\eggs.txt ] | path split
> [ /home/viking/spam.txt /home/viking/eggs.txt ] | path split
╭───┬──────────────────╮
│ 0 │ ╭───┬──────────╮ │
│ │ │ 0 │ C:\ │ │
│ │ │ 1 │ Users │ │
│ │ │ 0 │ / │ │
│ │ │ 1 │ home │ │
│ │ │ 2 │ viking │ │
│ │ │ 3 │ spam.txt │ │
│ │ ╰───┴──────────╯ │
│ 1 │ ╭───┬──────────╮ │
│ │ │ 0 │ C:\ │ │
│ │ │ 1 │ Users │ │
│ │ │ 0 │ / │ │
│ │ │ 1 │ home │ │
│ │ │ 2 │ viking │ │
│ │ │ 3 │ eggs.txt │ │
│ │ ╰───┴──────────╯ │
Expand Down