Skip to content

Commit

Permalink
Merge pull request #264 from rgwood/update-intro
Browse files Browse the repository at this point in the history
Update intro for latest Nu version
  • Loading branch information
fdncred committed Mar 7, 2022
2 parents 9cce399 + cef3fbb commit e108fd9
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 69 deletions.
4 changes: 2 additions & 2 deletions book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For the 0.44 version of Nushell, you should read the [0.44 version of the book](

Hello, and welcome to the Nushell project. The goal of this project is to take the Unix philosophy of shells, where pipes connect simple commands together, and bring it to the modern style of development.

Nu takes cues from a lot of familiar territory: traditional shells like bash, object based shells like PowerShell, functional programming, systems programming, and more. But rather than trying to be the jack of all trades, Nu focuses its energy on doing a few things well:
Nu takes cues from a lot of familiar territory: traditional shells like bash, object based shells like PowerShell, functional programming, systems programming, and more. But rather than trying to be a jack of all trades, Nu focuses its energy on doing a few things well:

* Create a flexible cross-platform shell with a modern feel
* Allow you to mix and match commandline applications with a shell that understands the structure of your data
Expand All @@ -21,7 +21,7 @@ The first thing you'll notice when you run a command like `ls` is that instead o

The table is more than just showing the directory in a different way. Just like tables in a spreadsheet, this table allows us to work with the data more interactively.

The first thing we'll do is to sort our table by the size. To do this, we'll take the output from `ls` and feed it into a command that can sort tables based on the contents of a column.
The first thing we'll do is to sort our table by size. To do this, we'll take the output from `ls` and feed it into a command that can sort tables based on the contents of a column.

<<< @/snippets/introduction/ls_sort_by_reverse_example.sh

Expand Down
2 changes: 1 addition & 1 deletion snippets/introduction/date_example.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
> date now
2020-09-09 09:14:51.684619600 +00:00
2022-03-07 14:14:51.684619600 -08:00
10 changes: 5 additions & 5 deletions snippets/introduction/date_table_example.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
> date now | date to-table
───┬──────┬───────┬─────┬──────┬────────┬────────┬──────────
# │ year │ month │ day │ hour │ minute │ second │ timezone
───┼──────┼───────┼─────┼──────┼────────┼────────┼──────────
0 │ 202099 9 1451 │ +00:00
───┴──────┴───────┴─────┴──────┴────────┴────────┴──────────
───┬──────┬───────┬─────┬──────┬────────┬────────┬──────────
# │ year │ month │ day │ hour │ minute │ second │ timezone
───┼──────┼───────┼─────┼──────┼────────┼────────┼──────────
0 │ 20223714 45 3 │ -08:00
───┴──────┴───────┴─────┴──────┴────────┴────────┴──────────
4 changes: 3 additions & 1 deletion snippets/introduction/help_example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ There are three ways to represent a path:
* As an inner list of path parts, e.g., '[[ / home viking spam.txt ]]'.
Splitting into parts is done by the `path split` command.

All subcommands accept all three variants as an input. Furthermore, the 'path
join' subcommand can be used to join the structured path or path parts back into
the path literal.

Usage:
> path
> path

Subcommands:
path basename - Get the final component of a path
Expand All @@ -29,3 +30,4 @@ Subcommands:

Flags:
-h, --help
Display this help message
18 changes: 9 additions & 9 deletions snippets/introduction/ls_example.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
> ls
────┬────────────────────┬──────┬────────┬────────────
#name │ type │ size modified
────┼────────────────────┼──────┼────────┼────────────
0 │ 404.html │ File │ 429 B │ 3 days ago
1 │ CONTRIBUTING.md │ File │ 955 B │ 8 mins ago
2 │ Gemfile │ File │ 1.1 KB │ 3 days ago
3 │ Gemfile.lock │ File │ 6.9 KB │ 3 days ago
4 │ LICENSE │ File │ 1.1 KB │ 3 days ago
5 │ README.md │ File │ 213 B │ 3 days ago
────┬───────────────────────┬──────┬───────────┬─────────────╮
#name │ type │ size modified
────┼───────────────────────┼──────┼───────────┼─────────────┤
0 │ 404.html │ file 429 B │ 3 days ago
1 │ CONTRIBUTING.md │ file 955 B │ 8 mins ago
2 │ Gemfile │ file 1.1 KiB │ 3 days ago
3 │ Gemfile.lock │ file 6.9 KiB │ 3 days ago
4 │ LICENSE │ file 1.1 KiB │ 3 days ago
5 │ README.md │ file 213 B │ 3 days ago
...
18 changes: 9 additions & 9 deletions snippets/introduction/ls_sort_by_reverse_example.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
> ls | sort-by size | reverse
────┬────────────────────┬──────┬────────┬────────────
#name │ type │ size modified
────┼────────────────────┼──────┼────────┼────────────
0 │ Gemfile.lock │ File │ 6.9 KB │ 3 days ago
1 │ SUMMARY.md │ File │ 3.7 KB │ 3 days ago
2 │ Gemfile │ File │ 1.1 KB │ 3 days ago
3 │ LICENSE │ File │ 1.1 KB │ 3 days ago
4 │ CONTRIBUTING.md │ File │ 955 B │ 9 mins ago
5 │ books.md │ File │ 687 B │ 3 days ago
────┬───────────────────────┬──────┬───────────┬─────────────╮
#name │ type │ size modified
────┼───────────────────────┼──────┼───────────┼─────────────┤
0 │ Gemfile.lock │ file 6.9 KiB │ 3 days ago
1 │ SUMMARY.md │ file 3.7 KiB │ 3 days ago
2 │ Gemfile │ file 1.1 KiB │ 3 days ago
3 │ LICENSE │ file 1.1 KiB │ 3 days ago
4 │ CONTRIBUTING.md │ file 955 B │ 9 mins ago
5 │ books.md │ file 687 B │ 3 days ago
...
16 changes: 8 additions & 8 deletions snippets/introduction/ls_where_example.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
> ls | where size > 1kb
───┬──────────────┬──────┬────────┬────────────
#name │ type │ size │ modified
───┼──────────────┼──────┼────────┼────────────
0 │ Gemfile │ File │ 1.1 KB │ 3 days ago
1 │ Gemfile.lock │ File │ 6.9 KB │ 3 days ago
2 │ LICENSE │ File │ 1.1 KB │ 3 days ago
3 │ SUMMARY.md │ File │ 3.7 KB │ 3 days ago
───┴──────────────┴──────┴────────┴────────────
───┬───────────────────┬──────┬────────┬────────────
#name │ type │ size │ modified
───┼───────────────────┼──────┼────────┼────────────
0 │ Gemfile │ file │ 1.1 KiB │ 3 days ago
1 │ Gemfile.lock │ file │ 6.9 KiB │ 3 days ago
2 │ LICENSE │ file │ 1.1 KiB │ 3 days ago
3 │ SUMMARY.md │ file │ 3.7 KiB │ 3 days ago
───┴───────────────────┴──────┴────────┴────────────
15 changes: 8 additions & 7 deletions snippets/introduction/ps_example.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
> ps
─────┬───────┬──────────────────┬─────────┬─────────┬──────────┬─────────
# │ pid │ name │ status │ cpu │ mem │ virtual
─────┼───────┼──────────────────┼─────────┼─────────┼──────────┼─────────
0 │ 33155 │ nu_plugin_core_p │ Running │ 3.8496 │ 1.8 MB │ 4.4 GB
1 │ 32841 │ mdworker_shared │ Running │ 0.0000 │ 19.3 MB │ 4.4 GB
2 │ 32829 │ CoreServicesUIAg │ Running │ 0.0000 │ 16.1 MB │ 4.5 GB
3 │ 32828 │ mdworker_shared │ Running │ 0.0000 │ 23.0 MB │ 4.4 GB
╭─────┬──────┬──────────────────────┬─────────┬───────┬───────────┬──────────╮
# │ pid │ name │ status │ cpu │ mem │ virtual │
├─────┼──────┼──────────────────────┼─────────┼───────┼───────────┼──────────┤
│ 0 │ 7570 │ nu │ Running │ 1.96 │ 23.2 MiB │ 32.8 GiB │
│ 1 │ 3533 │ remindd │ Sleep │ 0.00 │ 103.6 MiB │ 32.3 GiB │
│ 2 │ 3495 │ TVCacheExtension │ Sleep │ 0.00 │ 11.9 MiB │ 32.2 GiB │
│ 3 │ 3490 │ MusicCacheExtension │ Sleep │ 0.00 │ 12.9 MiB │ 32.2 GiB │
...
12 changes: 6 additions & 6 deletions snippets/introduction/ps_where_example.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
> ps | where cpu > 5
───┬──────┬──────────────────┬─────────┬────────┬──────────┬─────────
# │ pid │ name │ status │ cpu │ mem │ virtual
───┼──────┼──────────────────┼─────────┼────────┼──────────┼─────────
0 │ 3971Google Chrome He │ Running │ 5.1263 99.4 MB 5.5 GB
1 │ 360iTerm2 │ Running │ 6.6635218.6 MB 6.0 GB
───┴──────┴──────────────────┴─────────┴────────┴──────────┴─────────
───┬──────┬────────────────┬─────────┬────────┬──────────┬──────────╮
# │ pid │ name │ status │ cpu mem │ virtual
───┼──────┼────────────────┼─────────┼────────┼──────────┼──────────┤
0 │ 1583Terminal │ Running │ 20.69127.8 MiB33.0 GiB │
1 │ 579photoanalysisd │ Running │ 139.50 99.9 MiB32.3 GiB │
───┴──────┴────────────────┴─────────┴────────┴──────────┴──────────╯
16 changes: 8 additions & 8 deletions snippets/introduction/sys_example.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
> sys
─────────┬─────────────────────────────────────────
host │ [row 7 columns]
cpu │ [row cores current ghz max ghz min ghz]
disks │ [table 2 rows]
mem │ [row free swap free swap total total]
net │ [table 11 rows]
battery │ [table 1 rows]
─────────┴─────────────────────────────────────────
───────┬───────────────────
host │ {record 6 fields} │
cpu │ [table 4 rows] │
disks │ [table 3 rows]
mem │ {record 4 fields} │
│ temp │ [table 1 row] │
│ net │ [table 4 rows]
───────┴───────────────────
17 changes: 8 additions & 9 deletions snippets/introduction/sys_get_example.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
> sys | get host
──────────┬─────────────────────────────────────────────
name │ Linux
release │ 5.3.0-1019-azure
version │ #20-Ubuntu SMP Fri Mar 27 23:54:23 UTC 2020
hostname │ lifeless
arch │ x86_64
uptime │ 8:03:47:32
sessions │ [table 2 rows]
──────────┴─────────────────────────────────────────────
╭────────────────┬────────────────────────╮
│ name │ Debian GNU/Linux │
│ os version │ 11 │
│ kernel version │ 5.10.92-v8+ │
│ hostname │ lifeless │
│ uptime │ 19day 21hr 34min 45sec │
│ sessions │ [table 1 row] │
╰────────────────┴────────────────────────╯
2 changes: 1 addition & 1 deletion snippets/introduction/sys_get_external_echo_example.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
> sys | get host.sessions.name | each { ^echo $it }
> sys | get host.sessions.name | each { |it| ^echo $it }
jt
6 changes: 3 additions & 3 deletions snippets/introduction/sys_get_nested_example.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> sys | get host.sessions.name
───┬────
0 │ jt
───┴────
───┬────
0 │ jt
───┴────

0 comments on commit e108fd9

Please sign in to comment.