Skip to content

Commit

Permalink
Update docs for sys deprecation in 0.94.0 (#1387)
Browse files Browse the repository at this point in the history
* Update docs for `sys` deprecation

* Add `null` return

* Restore old examples

* Rework structured data examples

* Restore make_docs.nu
  • Loading branch information
IanManske committed May 29, 2024
1 parent de933d0 commit 246c021
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 117 deletions.
2 changes: 1 addition & 1 deletion book/coming_from_bash.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Note: this table assumes Nu 0.91.0 or later.
| `command1 && command2` | `command1; command2` | Run a command, and if it's successful run a second |
| `stat $(which git)` | `stat (which git).path` | Use command output as argument for other command |
| `echo /tmp/$RANDOM` | `$"/tmp/(random integer)"` | Use command output in a string |
| `cargo b --jobs=$(nproc)` | `cargo b $"--jobs=(sys \| get cpu \| length)"` | Use command output in an option |
| `cargo b --jobs=$(nproc)` | `cargo b $"--jobs=(sys cpu \| length)"` | Use command output in an option |
| `echo $PATH` | `$env.PATH` (Non-Windows) or `$env.Path` (Windows) | See the current path |
| `<update ~/.bashrc>` | `vim $nu.config-path` | Update PATH permanently |
| `export PATH = $PATH:/usr/other/bin` | `$env.PATH = ($env.PATH \| append /usr/other/bin)` | Update PATH temporarily |
Expand Down
73 changes: 0 additions & 73 deletions book/introduction.md

This file was deleted.

6 changes: 4 additions & 2 deletions book/nushell_map.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The idea behind this table is to help you understand how Nu builtins and plugins relate to other known shells and domain specific languages. We've tried to produce a map of relevant Nu commands and what their equivalents are in other languages. Contributions are welcome.

Note: this table assumes Nu 0.43 or later.
Note: this table assumes Nu 0.94 or later.


| Nushell | SQL | .Net LINQ (C#) | PowerShell (without external modules) | Bash |
Expand Down Expand Up @@ -59,7 +59,9 @@ Note: this table assumes Nu 0.43 or later.
| str join | concat_ws | Join | Join-String | |
| str trim | rtrim, ltrim | Trim, TrimStart, TrimEnd | Trim | |
| sum | sum | Sum | Measure-Object, measure | |
| sys | | | Get-ComputerInfo | uname, lshw, lsblk, lscpu, lsusb, hdparam, free |
| sys host | | | Get-ComputerInfo | uname |
| sys disks | | | Get-ComputerInfo | lsblk |
| sys mem | | | Get-ComputerInfo | free |
| table | | | Format-Table, ft, Format-List, fl | |
| take | top, limit | Take | Select-Object -First | head |
| take until | | TakeWhile | | |
Expand Down
9 changes: 4 additions & 5 deletions book/nushell_map_imperative.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Note: this table assumes Nu 0.43 or later.
| du | shutil.disk_usage | | | |
| each | for | for | for | for |
| exit | exit | System.exit, kotlin.system.exitProcess | exit | exit |
| http get | urllib.request.urlopen | | | |
| http get | urllib.request.urlopen | | | |
| first | list[:x] | List[0], peek | vector[0], top | Vec[0] |
| format | format | format | format | format! |
| from | csv, json, sqlite3 | | | |
Expand All @@ -32,7 +32,7 @@ Note: this table assumes Nu 0.43 or later.
| kill | os.kill | | | |
| last | list[-x:] | | | &Vec[Vec.len()-1] |
| lines | split, splitlines | split | views::split | split, split_whitespace, rsplit, lines |
| ls | os.listdir | | | fs::read_dir |
| ls | os.listdir | | | fs::read_dir |
| match | match | when | | match |
| merge | dict.append | | | map.extend |
| mkdir | os.mkdir | | | fs::create_dir |
Expand All @@ -57,20 +57,19 @@ Note: this table assumes Nu 0.43 or later.
| size | len | | | len |
| skip | list[x:] | | | &Vec[x..],skip |
| skip until | itertools.dropwhile | | | |
| skip while | itertools.dropwhile | | | skip_while |
| skip while | itertools.dropwhile | | | skip_while |
| sort-by | sorted, list.sort | sortedBy, sortedWith, Arrays.sort, Collections.sort | sort | sort |
| split row | str.split{,lines}, re.split | split | views::split | split |
| str | str functions | String functions | string functions | &str, String functions |
| str join | str.join | joinToString | | join |
| str trim | strip, rstrip, lstrip | trim, trimStart, trimEnd | regex | trim, trim*{start,end}, strip*{suffix,prefix} |
| sum | sum | sum | reduce | sum |
| sys | sys | | | |
| to | import csv, json, sqlite3 | | | |
| touch | open(path, 'a').close() | | | |
| uniq | set | Set | set | HashSet |
| upsert | dict[\"key\"] = val | | | |
| version | sys.version, sys.version_info | | | |
| with-env | os.environ | | | |
| where | filter | filter | filter | filter |
| where | filter | filter | filter | filter |
| which | shutil.which | | | |
| wrap | { "key" : val } | | | |
2 changes: 1 addition & 1 deletion book/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ operator. You can use the spread multiple records inside a single record literal
...$config,
users: [alice bob],
...{ url: example.com },
...(sys | get mem)
...(sys mem)
}
╭────────────┬───────────────╮
│ path │ /tmp │
Expand Down
Loading

0 comments on commit 246c021

Please sign in to comment.