A new type of shell
Go to file
2019-06-22 16:46:16 -04:00
.cargo Finish nom upgrade 2019-06-22 10:08:53 -04:00
docs Added philosophy.md 2019-06-06 10:58:39 -07:00
images Delete nushell-autocomplete2.gif 2019-06-03 07:16:49 +12:00
src &str -> Text 2019-06-22 16:46:16 -04:00
tests Things work 2019-06-21 21:36:57 -04:00
.editorconfig Add editorconfig 2019-05-11 00:03:11 -07:00
.gitignore Internals cleanup and | select ...fields 2019-05-15 13:14:51 -05:00
Cargo.lock &str -> Text 2019-06-22 16:46:16 -04:00
Cargo.toml Things work 2019-06-21 21:36:57 -04:00
LICENSE Create LICENSE 2019-06-03 04:47:52 +12:00
Makefile.toml Add --loglevel and --develop 2019-06-01 10:00:42 -07:00
README.md Update README.md 2019-06-11 18:36:31 +12:00
rustfmt.toml Data flows across commands via streams now 2019-05-23 00:23:06 -07:00

Nu Shell

A shell for the GitHub era. Like having a playground for a shell.

Status

This project has little of what will eventually be necessary for Nu to serve as your day-to-day shell. It already works well enough for contributors to dogfood it as their daily driver, but there are too many basic deficiencies for it to be useful for most people.

At the moment, executing a command that isn't identified as a built-in new command will fall back to running it as a shell command (using cmd on Windows or bash on Linux and MacOS), correctly passing through stdin, stdout and stderr, so things like your daily git workflows and even vim will work just fine.

Commands

command description
cd directory Change to the given directory
ls View current directory contents
ps View current processes
open filename Load a file into a cell, convert to table if possible (avoid by appending '--raw')

Commands on tables

command description
pick ...columns Down-select table to only these columns
reject ...columns Remove the given columns from the table
get column-or-column-path Open given cells as text
sort-by ...columns Sort by the given columns
where condition Filter table to match the condition
skip amount Skip a number of rows
first amount Show only the first number of rows
to-array Collapse rows into a single list
to-json Convert table into .json text
to-toml Convert table into .toml text

Commands on text

command description
from-json Parse text as .json and create table
from-toml Parse text as .toml and create table
from-xml Parse text as .xml and create a table
from-yaml Parse text as a .yaml/.yml and create a table
split-column sep ...fields Split row contents across multiple columns via the separator
split-row sep Split row contents over multiple rows via the separator
trim Trim leading and following whitespace from text data
{external-command} $it Run external command with given arguments, replacing $it with each row text

Goals

Prime Directive: Cross platform workflows, with first-class consistent support for Windows, OSX and Linux.

Priority #1: direct compatibility with existing platform-specific executables that make up people's workflows

Priority #2: Create workflow tools that more closely match the day-to-day experience of using a shell in 2019 (and beyond)

Priority #3: It's an object shell like PowerShell.

These goals are all critical, project-defining priorities. Priority #1 is "direct compatibility" because any new shell absolutely needs a way to use existing executables in a direct and natural way.

License

The project is made available under the MIT license. See "LICENSE" for more information.

A Taste of Nu

Nu has built-in commands for ls and ps, loading these results into a table you can work with.

~\Code\nushell> ps | where cpu > 0
------------------------------------------------
 name               cmd  cpu    pid    status
------------------------------------------------
 msedge.exe         -    0.77   26472  Runnable
------------------------------------------------
 nu.exe             -    7.83   15473  Runnable
------------------------------------------------
 SearchIndexer.exe  -    82.17  23476  Runnable
------------------------------------------------
 BlueJeans.exe      -    4.54   10000  Runnable
------------------------------------------------

Commands are linked together with pipes, allowing you to select the data you want to use.

~\Code\nushell> ps | where name == chrome.exe | first 5
----------------------------------------
 name        cmd  cpu   pid    status
----------------------------------------
 chrome.exe  -    0.00  22092  Runnable
----------------------------------------
 chrome.exe  -    0.00  17324  Runnable
----------------------------------------
 chrome.exe  -    0.00  16376  Runnable
----------------------------------------
 chrome.exe  -    0.00  21876  Runnable
----------------------------------------
 chrome.exe  -    0.00  13432  Runnable
----------------------------------------

The name of the columns in the table can be used to sort the table.

~\Code\nushell> ls | sort-by "file type" size
----------------------------------------------------------------------------------------
 file name      file type  readonly  size      created       accessed      modified
----------------------------------------------------------------------------------------
 .cargo         Directory            Empty     a week ago    a week ago    a week ago
----------------------------------------------------------------------------------------
 .git           Directory            Empty     2 weeks ago   9 hours ago   9 hours ago
----------------------------------------------------------------------------------------
 images         Directory            Empty     2 weeks ago   2 weeks ago   2 weeks ago
----------------------------------------------------------------------------------------
 src            Directory            Empty     2 weeks ago   10 hours ago  10 hours ago
----------------------------------------------------------------------------------------
 target         Directory            Empty     10 hours ago  10 hours ago  10 hours ago
----------------------------------------------------------------------------------------
 tests          Directory            Empty     14 hours ago  10 hours ago  10 hours ago
----------------------------------------------------------------------------------------
 tmp            Directory            Empty     2 days ago    2 days ago    2 days ago
----------------------------------------------------------------------------------------
 rustfmt.toml   File                 16 B      a week ago    a week ago    a week ago
----------------------------------------------------------------------------------------
 .gitignore     File                 32 B      2 weeks ago   2 weeks ago   2 weeks ago
----------------------------------------------------------------------------------------
 .editorconfig  File                 156 B     2 weeks ago   2 weeks ago   2 weeks ago
----------------------------------------------------------------------------------------

You can also use the names of the columns to down-select to only the data you want.

~\Code\nushell> ls | pick "file name" "file type" size | sort-by "file type"
------------------------------------
 file name      file type  size
------------------------------------
 .cargo         Directory  Empty
------------------------------------
 .git           Directory  Empty
------------------------------------
 images         Directory  Empty
------------------------------------
 src            Directory  Empty
------------------------------------
 target         Directory  Empty
------------------------------------
 tests          Directory  Empty
------------------------------------
 rustfmt.toml   File       16 B
------------------------------------
 .gitignore     File       32 B
------------------------------------
 .editorconfig  File       156 B
------------------------------------

Some file types can be loaded as tables.

~\Code\nushell> open Cargo.toml
----------------------------------------------------
 dependencies     dev-dependencies  package
----------------------------------------------------
 [object Object]  [object Object]   [object Object]
----------------------------------------------------

~\Code\nushell> open Cargo.toml | get package
--------------------------------------------------------------------------
 authors      description                 edition  license  name  version
--------------------------------------------------------------------------
 [list List]  A shell for the GitHub era  2018     MIT      nu    0.1.1
--------------------------------------------------------------------------

Once you've found the data, you can call out to external applications and use it.

~\Code\nushell> open Cargo.toml | get package.version | echo $it
0.1.1

Nu currently has fish-style completion of previous commands, as well ctrl-r reverse search.

autocompletion