Home Explore Blog CI



nushell

12th chunk of `blog/2019-08-23-introducing-nushell.md`
b0fceb9eebf908f6a09d2930d42c8dbb7f91aca683130c4600000001000008fa
------------+--------------+------------------+----------+----------
> open Cargo.toml | tags
----------+------------------------------------------
 span     | origin
----------+------------------------------------------
 [object] | /home/sophia/Source/nushell/Cargo.toml
----------+------------------------------------------
```

Data that flows through the pipeline gets a set of additional metadata tagged to it. We can use this later to figure out how to display the contents, show a better error message, and more.

# Shells, plural

Let's say you're in a directory, but you'd really like to flip back and forth between it and one or two others. You could open up multiple tabs, multiple terminals, if you're on a Unix system you could use "screen", and probably even more than that. What if the shells were just built in?

In Nu, we can `enter` a directory, which adds it to a ring of shells we can bounce between:

```
> enter ../rhai/
/home/sophia/Source/rhai(master)> shells
---+---+------------+-----------------------------
 # |   | name       | path
---+---+------------+-----------------------------
 0 |   | filesystem | /home/sophia/Source/nushell
 1 | X | filesystem | /home/sophia/Source/rhai
---+---+------------+-----------------------------
```

Using `n` and `p` we can jump back and forth between the shells. `exit` gets us out of a shell.

You might noticed that `name` column in the `shells` table. Why's that there? Oh no... oh yes.

```
> enter Cargo.toml
/> shells
---+---+--------------------------------------------+-----------------------------
 # |   | name                                       | path
---+---+--------------------------------------------+-----------------------------
 0 |   | filesystem                                 | /home/sophia/Source/nushell
 1 |   | filesystem                                 | /home/sophia/Source/rhai
 2 | X | {/home/sophia/Source/nushell/Cargo.toml} | /
---+---+--------------------------------------------+-----------------------------
```

That's right, we're in the file. Can we `cd`? Oh yes, we can:

```
/> ls
------------+--------------+------------------+----------+----------
 bin        | dependencies | dev-dependencies | lib      | package
------------+--------------+------------------+----------+----------

Title: Shells, Plural: Managing Directories and Files as Shells in Nu
Summary
Nu allows users to manage multiple directories as shells, quickly switching between them using `enter`, `n`, and `p`. Users can also enter files, treating them as directories, and navigate their contents using commands like `ls`.