├── apt.txt
├── jupyter_lab.png
├── jupyter_example.png
├── dist
└── nu_jupyter-0.0.0-py3.7.egg
├── kernel.json
├── setup.py
├── .gitignore
├── environment.yml
├── postBuild
├── LICENSE
├── README.md
├── nushellkernel.py
└── NoteBook-v0.14.ipynb
/apt.txt:
--------------------------------------------------------------------------------
1 | libxcb-shape0
2 | libxcb-xfixes0
3 |
--------------------------------------------------------------------------------
/jupyter_lab.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nushell/nu_jupyter/HEAD/jupyter_lab.png
--------------------------------------------------------------------------------
/jupyter_example.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nushell/nu_jupyter/HEAD/jupyter_example.png
--------------------------------------------------------------------------------
/dist/nu_jupyter-0.0.0-py3.7.egg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nushell/nu_jupyter/HEAD/dist/nu_jupyter-0.0.0-py3.7.egg
--------------------------------------------------------------------------------
/kernel.json:
--------------------------------------------------------------------------------
1 | {"argv":["python","-m","nushellkernel", "-f", "{connection_file}"],
2 | "display_name":"Nushell"
3 | }
4 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup, find_packages
2 |
3 | setup(
4 | name = "nu_jupyter",
5 | verion = "0.1",
6 | packages = find_packages()
7 | )
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | nu_jupyter.egg-inf/
3 | nu_jupyter.egg-info/dependency_links.txt
4 | nu_jupyter.egg-info/PKG-INFO
5 | nu_jupyter.egg-info/SOURCES.txt
6 | nu_jupyter.egg-info/top_level.txt
7 |
--------------------------------------------------------------------------------
/environment.yml:
--------------------------------------------------------------------------------
1 | channels:
2 | - conda-forge
3 | dependencies:
4 | # Jupyter
5 | - jupyterlab=2
6 | - nodejs=11
7 | - nbconvert=5.5
8 | - widgetsnbextension=3.5
9 | # Python Kernel
10 | - ipykernel=5.1
11 | - ipywidgets=7.5
12 | - ipyleaflet=0.12
13 | - altair=3.1
14 | - bqplot=0.12
15 | - dask=2.1
16 | - matplotlib=3.1
17 | - pandas=0.24
18 | - python=3.7
19 | - scikit-image=0.15
20 | - scikit-learn=0.21
21 | - seaborn=0.9
22 | - tensorflow=1.13
23 | - sympy=1.4
24 | - pyyaml
25 | - traittypes==0.2.1
26 | - invoke=1.2
--------------------------------------------------------------------------------
/postBuild:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | set -ex
3 |
4 | # Install Homebrew
5 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
6 | # Following Brew's instructions
7 | echo 'eval $(/home/jovyan/.linuxbrew/bin/brew shellenv)' >> /home/jovyan/.profile
8 | eval $(/home/jovyan/.linuxbrew/bin/brew shellenv)
9 | brew tap linuxbrew/xorg
10 | brew install gcc
11 | # Let's install rust
12 | #brew install rustup
13 | #rustup-init
14 | # Use Brew to install NuShell
15 | #brew install nushell
16 |
17 | #curl https://sh.rustup.rs -sSf | sh -- -y
18 | curl https://sh.rustup.rs -sSf > ~/rustup-init.sh
19 | chmod +x ~/rustup-init.sh
20 | ~/rustup-init.sh -y
21 | source $HOME/.cargo/env
22 | # Rustup
23 | rustc --version
24 | # Install NuShell with Cargo
25 | #cargo install nu --features=stable
26 | #cargo install nu --features=average,fetch,inc,match,post,ps,start,str,sys,textview,tree
27 | cargo install nu
28 | # Pull tree
29 | git clone https://github.com/fdncred/nu_jupyter.git
30 | cd nu_jupyter
31 | # Install NuShell kernelspec
32 | #python setup.py bdist_egg
33 | jupyter kernelspec install ../nu_jupyter --user
34 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 nushell
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Jupyter Notebook support for Nushell
2 |
3 | 
4 |
5 | This is a very(!) experimental kernel for Jupyter for running Nushell. It currently requires 0.11.1 or later.
6 |
7 | To install and run the kernel:
8 |
9 | ```
10 | > cd nu_jupyter
11 | nu_jupyter> jupyter kernelspec install ../nu_jupyter --user
12 | nu_jupyter> jupyter lab
13 | ```
14 |
15 | Limitations:
16 |
17 | * State is not kept between runs. This is something that will change in future versions.
18 |
19 | ## How to create the python egg
20 | This step is only needed if you've made changes to the nushell kernelspec.
21 |
22 | ### Creating the python egg
23 | To create the egg file do the following:
24 | ```
25 | > cd nu_jupyter
26 | nu_jupyter> python.exe setup.py bdist_egg
27 | ```
28 | This creates an egg file in the `dist` folder that pipenv can utilize.
29 |
30 | ## Installing using pipenv
31 | From within your pipenv environment folder, mine is called `me/jup`.
32 | ```
33 | jup> pipenv install -e git+https://github.com/nushell/nu_jupyter.git#egg=dist
34 | ```
35 | This should add the nu_jupyter kernelspec and insert entries in your pipfile and pipfile.lock file.
36 | ## Running with pipenv
37 | From within your pipenv env folder, mine is called `/me/jup`.
38 | ```
39 | # To activate your pipenv environment, run
40 | jup> pipenv shell
41 |
42 | # To add the new jupyter kernel
43 | jup> jupyter kernelspec install ../nu_jupyter --user
44 |
45 | # To launch jupyter lab, run
46 | jup> jupyter lab
47 | ```
48 | After launching you should have jupyter lab looking similar to this.
49 | 
50 | The last thing is to ensure that NuShell is somewhere in your path. Jupyter requires access to it in order to run the commands in the notebook.
--------------------------------------------------------------------------------
/nushellkernel.py:
--------------------------------------------------------------------------------
1 | from ipykernel.kernelbase import Kernel
2 | import subprocess
3 | import json
4 | import tempfile
5 |
6 | class NushellKernel(Kernel):
7 | implementation = 'Nushell'
8 | implementation_version = '1.0'
9 | language = 'no-op'
10 | language_version = '0.1'
11 | language_info = {
12 | 'name': 'Any text',
13 | 'mimetype': 'text/plain',
14 | 'file_extension': '.txt',
15 | }
16 | banner = "Nushell kernel - let's have fun"
17 |
18 | def do_execute(self, code, silent, store_history=True, user_expressions=None,
19 | allow_stdin=False):
20 | if not silent:
21 | temp = tempfile.NamedTemporaryFile(suffix=".nu")
22 | for line in code.splitlines():
23 | line = line + " | to html\n"
24 | temp.write(line.encode('utf-8'))
25 | temp.flush()
26 | command = 'nu ' + temp.name
27 |
28 | p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
29 | (output, err) = p.communicate()
30 | p_status = p.wait()
31 |
32 | output = output.decode('utf-8')
33 | err = err.decode()
34 |
35 | if err:
36 | display_data = {
37 | 'data': {
38 | "text/plain": err,
39 | },
40 | 'metadata': {},
41 | }
42 | self.send_response(self.iopub_socket, 'display_data', display_data)
43 | else:
44 | display_data = {
45 | 'data': {
46 | "text/html": output,
47 | },
48 | 'metadata': {},
49 | }
50 | self.send_response(self.iopub_socket, 'display_data', display_data)
51 |
52 | temp.close()
53 | return {'status': 'ok',
54 | # The base class increments the execution count
55 | 'execution_count': self.execution_count,
56 | 'payload': [],
57 | 'user_expressions': {},
58 | }
59 |
60 | if __name__ == '__main__':
61 | from ipykernel.kernelapp import IPKernelApp
62 | IPKernelApp.launch_instance(kernel_class=NushellKernel)
63 |
--------------------------------------------------------------------------------
/NoteBook-v0.14.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "### Introduction\n",
8 | "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.\n",
9 | "\n",
10 | "Nu takes cues from a lot of familiar territory: traditional shells like bash, advanced 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:\n",
11 | "\n",
12 | "* Create a flexible cross-platform shell with a modern feel\n",
13 | "* Allow you to mix and match commandline applications with a shell that understands the structure of your data\n",
14 | "* Have the level of UX polish that modern CLI apps provide\n",
15 | "\n",
16 | "The easiest way to see what Nu can do is to start with some examples, so let's dive in.\n",
17 | "\n",
18 | "The first thing you'll notice when you run a command like `ls` is that instead of a block of text coming back, you get a structured table."
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": 7,
24 | "metadata": {},
25 | "outputs": [
26 | {
27 | "data": {
28 | "text/html": [
29 | "
| name | type | size | modified |
|---|
| .azure | Dir | 0 B | 1 day ago |
| .cargo | Dir | 0 B | 2 months ago |
| .circleci | Dir | 0 B | 2 months ago |
| .dockerignore | File | 7 B | 2 months ago |
| .editorconfig | File | 223 B | 2 months ago |
| .github | Dir | 0 B | 2 months ago |
| .gitignore | File | 303 B | 2 weeks ago |
| .gitpod.Dockerfile | File | 302 B | 1 week ago |
| .gitpod.yml | File | 891 B | 1 week ago |
| .idea | Dir | 0 B | 4 days ago |
| .ipynb_checkpoints | Dir | 0 B | 6 mins ago |
| .theia | Dir | 0 B | 1 week ago |
| .vscode | Dir | 0 B | 4 days ago |
| CODE_OF_CONDUCT.md | File | 3.4 KB | 2 months ago |
| CONTRIBUTING.md | File | 914 B | 3 weeks ago |
| Cargo.lock | File | 108.9 KB | 21 hours ago |
| Cargo.toml | File | 5.5 KB | 1 day ago |
| LICENSE | File | 1.1 KB | 2 months ago |
| Makefile.toml | File | 449 B | 2 months ago |
| NoteBook-v1.0.ipynb | File | 1.1 KB | 1 min ago |
| README.md | File | 14.0 KB | 5 days ago |
| TODO.md | File | 1.6 KB | 2 months ago |
| assets | Dir | 0 B | 2 months ago |
| build.rs | File | 78 B | 2 months ago |
| crates | Dir | 4.1 KB | 1 day ago |
| debian | Dir | 4.1 KB | 2 months ago |
| docker | Dir | 4.1 KB | 2 months ago |
| docs | Dir | 0 B | 2 months ago |
| features.toml | File | 632 B | 2 months ago |
| images | Dir | 0 B | 2 months ago |
| rustfmt.toml | File | 16 B | 2 months ago |
| src | Dir | 4.1 KB | 1 day ago |
| target | Dir | 0 B | 21 hours ago |
| tests | Dir | 0 B | 2 months ago |
"
30 | ]
31 | },
32 | "metadata": {},
33 | "output_type": "display_data"
34 | }
35 | ],
36 | "source": [
37 | "ls"
38 | ]
39 | },
40 | {
41 | "cell_type": "markdown",
42 | "metadata": {},
43 | "source": [
44 | "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.\n",
45 | "\n",
46 | "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."
47 | ]
48 | },
49 | {
50 | "cell_type": "code",
51 | "execution_count": 8,
52 | "metadata": {},
53 | "outputs": [
54 | {
55 | "data": {
56 | "text/html": [
57 | "| name | type | size | modified |
|---|
| Cargo.lock | File | 108.9 KB | 21 hours ago |
| README.md | File | 14.0 KB | 5 days ago |
| Cargo.toml | File | 5.5 KB | 1 day ago |
| NoteBook-v1.0.ipynb | File | 4.7 KB | 27 secs ago |
| src | Dir | 4.1 KB | 1 day ago |
| docker | Dir | 4.1 KB | 2 months ago |
| debian | Dir | 4.1 KB | 2 months ago |
| crates | Dir | 4.1 KB | 1 day ago |
| CODE_OF_CONDUCT.md | File | 3.4 KB | 2 months ago |
| TODO.md | File | 1.6 KB | 2 months ago |
| LICENSE | File | 1.1 KB | 2 months ago |
| CONTRIBUTING.md | File | 914 B | 3 weeks ago |
| .gitpod.yml | File | 891 B | 1 week ago |
| features.toml | File | 632 B | 2 months ago |
| Makefile.toml | File | 449 B | 2 months ago |
| .gitignore | File | 303 B | 2 weeks ago |
| .gitpod.Dockerfile | File | 302 B | 1 week ago |
| .editorconfig | File | 223 B | 2 months ago |
| build.rs | File | 78 B | 2 months ago |
| rustfmt.toml | File | 16 B | 2 months ago |
| .dockerignore | File | 7 B | 2 months ago |
| tests | Dir | 0 B | 2 months ago |
| target | Dir | 0 B | 21 hours ago |
| images | Dir | 0 B | 2 months ago |
| docs | Dir | 0 B | 2 months ago |
| assets | Dir | 0 B | 2 months ago |
| .vscode | Dir | 0 B | 4 days ago |
| .theia | Dir | 0 B | 1 week ago |
| .ipynb_checkpoints | Dir | 0 B | 7 mins ago |
| .idea | Dir | 0 B | 4 days ago |
| .github | Dir | 0 B | 2 months ago |
| .circleci | Dir | 0 B | 2 months ago |
| .cargo | Dir | 0 B | 2 months ago |
| .azure | Dir | 0 B | 1 day ago |
"
58 | ]
59 | },
60 | "metadata": {},
61 | "output_type": "display_data"
62 | }
63 | ],
64 | "source": [
65 | "ls | sort-by size | reverse"
66 | ]
67 | },
68 | {
69 | "cell_type": "markdown",
70 | "metadata": {},
71 | "source": [
72 | "You can see that to make this work we didn't pass commandline arguments to `ls`. Instead, we used the `sort-by` command that Nu provides to do the sorting of the output of the `ls` command. To see the biggest files on top, we also used `reverse`.\n",
73 | "\n",
74 | "Nu provides many commands that can work on tables. For example, we could filter the contents of the `ls` table so that it only shows files over 1 kilobyte:"
75 | ]
76 | },
77 | {
78 | "cell_type": "code",
79 | "execution_count": 9,
80 | "metadata": {},
81 | "outputs": [
82 | {
83 | "data": {
84 | "text/html": [
85 | "| name | type | size | modified |
|---|
| CODE_OF_CONDUCT.md | File | 3.4 KB | 2 months ago |
| Cargo.lock | File | 108.9 KB | 21 hours ago |
| Cargo.toml | File | 5.5 KB | 1 day ago |
| LICENSE | File | 1.1 KB | 2 months ago |
| NoteBook-v1.0.ipynb | File | 4.7 KB | 1 min ago |
| README.md | File | 14.0 KB | 5 days ago |
| TODO.md | File | 1.6 KB | 2 months ago |
| crates | Dir | 4.1 KB | 1 day ago |
| debian | Dir | 4.1 KB | 2 months ago |
| docker | Dir | 4.1 KB | 2 months ago |
| src | Dir | 4.1 KB | 1 day ago |
"
86 | ]
87 | },
88 | "metadata": {},
89 | "output_type": "display_data"
90 | }
91 | ],
92 | "source": [
93 | "ls | where size > 1kb"
94 | ]
95 | },
96 | {
97 | "cell_type": "markdown",
98 | "metadata": {},
99 | "source": [
100 | "Just as in the Unix philosophy, being able to have commands talk to each other gives us ways to mix-and-match in many different combinations. Let's look at a different command:"
101 | ]
102 | },
103 | {
104 | "cell_type": "code",
105 | "execution_count": 11,
106 | "metadata": {},
107 | "outputs": [
108 | {
109 | "data": {
110 | "text/html": [
111 | "| pid | name | status | cpu | mem | virtual |
|---|
| 10912 | sihost.exe | Running | 0.0000 | 23.8 MB | 10.5 MB |
| 11076 | svchost.exe | Running | 0.0000 | 21.1 MB | 11.2 MB |
| 11216 | svchost.exe | Running | 0.0000 | 3.3 MB | 2.2 MB |
| 11252 | svchost.exe | Running | 0.0000 | 33.1 MB | 10.3 MB |
| 10484 | taskhostw.exe | Running | 0.0000 | 14.5 MB | 11.8 MB |
"
112 | ]
113 | },
114 | "metadata": {},
115 | "output_type": "display_data"
116 | }
117 | ],
118 | "source": [
119 | "ps | first 5"
120 | ]
121 | },
122 | {
123 | "cell_type": "markdown",
124 | "metadata": {},
125 | "source": [
126 | "You may be familiar with the `ps` command if you've used Linux. With it, we can get a list of all the current processes that the system is running, what their status is, and what their name is. We can also see the CPU load for the process.\n",
127 | "\n",
128 | "What if we wanted to show the processes that were actively using the CPU? Just like we did with the `ls` command earlier, we can also work with the table that the `ps` command gives back to us:"
129 | ]
130 | },
131 | {
132 | "cell_type": "code",
133 | "execution_count": 12,
134 | "metadata": {},
135 | "outputs": [
136 | {
137 | "data": {
138 | "text/html": [
139 | "| pid | name | status | cpu | mem | virtual |
|---|
| 38872 | RuntimeBroker.exe | Running | 11.3222 | 20.6 MB | 4.4 MB |
| 30084 | nu_plugin_ps.exe | Running | 84.3243 | 4.4 MB | 2.5 MB |
"
140 | ]
141 | },
142 | "metadata": {},
143 | "output_type": "display_data"
144 | }
145 | ],
146 | "source": [
147 | "ps | where cpu > 10"
148 | ]
149 | },
150 | {
151 | "cell_type": "markdown",
152 | "metadata": {},
153 | "source": [
154 | "So far, we've seen using `ls` and `ps` to list files and processes. Nu also offers other commands that can create tables of useful information. Next, let's explore `date` and `sys`.\n",
155 | "\n",
156 | "Running `date` gives us information about the current day and time:"
157 | ]
158 | },
159 | {
160 | "cell_type": "code",
161 | "execution_count": 22,
162 | "metadata": {},
163 | "outputs": [
164 | {
165 | "data": {
166 | "text/html": [
167 | "| year | month | day | hour | minute | second | timezone |
|---|
| 2020 | 5 | 19 | 11 | 7 | 11 | -05:00 |
"
168 | ]
169 | },
170 | "metadata": {},
171 | "output_type": "display_data"
172 | }
173 | ],
174 | "source": [
175 | "date"
176 | ]
177 | },
178 | {
179 | "cell_type": "markdown",
180 | "metadata": {},
181 | "source": [
182 | "Running `sys` gives information about the system that Nu is running on:"
183 | ]
184 | },
185 | {
186 | "cell_type": "code",
187 | "execution_count": 23,
188 | "metadata": {},
189 | "outputs": [
190 | {
191 | "data": {
192 | "text/html": [
193 | "| host | cpu | disks | mem |
|---|
| [row 7 columns] | [row cores current ghz max ghz] | [table 4 rows] | [row free swap free swap total total] |
"
194 | ]
195 | },
196 | "metadata": {},
197 | "output_type": "display_data"
198 | }
199 | ],
200 | "source": [
201 | "sys"
202 | ]
203 | },
204 | {
205 | "cell_type": "markdown",
206 | "metadata": {},
207 | "source": [
208 | "This is a bit different than the tables we saw before. The `sys` command gives us a table that contains structured tables in the cells instead of simple values. To take a look at this data, we need to select the column to view:"
209 | ]
210 | },
211 | {
212 | "cell_type": "code",
213 | "execution_count": 24,
214 | "metadata": {},
215 | "outputs": [
216 | {
217 | "data": {
218 | "text/html": [
219 | "| name | release | version | hostname | arch | uptime | sessions |
|---|
| Windows | 10 | 18363 | lifeless | x86_64 | 6:00:49:11 | [table 1 rows] |
"
220 | ]
221 | },
222 | "metadata": {},
223 | "output_type": "display_data"
224 | }
225 | ],
226 | "source": [
227 | "sys | get host"
228 | ]
229 | },
230 | {
231 | "cell_type": "markdown",
232 | "metadata": {},
233 | "source": [
234 | "The `get` command lets us jump into the contents of a column of the table. Here, we're looking into the \"host\" column, which contains information about the host that Nu is running on. The name of the OS, the hostname, the CPU, and more. Let's get the name of the users on the system:"
235 | ]
236 | },
237 | {
238 | "cell_type": "code",
239 | "execution_count": 18,
240 | "metadata": {},
241 | "outputs": [
242 | {
243 | "data": {
244 | "text/html": [
245 | "jonathan"
246 | ]
247 | },
248 | "metadata": {},
249 | "output_type": "display_data"
250 | }
251 | ],
252 | "source": [
253 | "sys | get host.sessions"
254 | ]
255 | },
256 | {
257 | "cell_type": "markdown",
258 | "metadata": {},
259 | "source": [
260 | "Right now, there's just one user on the system named \"jonathan\". You'll notice that we can pass a path (the `host.sessions` part) and not just the name of the column. Nu will take the path and go to the corresponding bit of data in the table.\n",
261 | "\n",
262 | "You might have noticed something else that's different. Rather than having a table of data, we have just a single element: the string \"jonathan\". Nu works with both tables of data as well as strings. Strings are an important part of working with commands outside of Nu.\n",
263 | "\n",
264 | "Let's see how strings work outside of Nu in action. We'll take our example from before and run the external `echo` command (the `^` tells nu to not use the built-in `echo` command):"
265 | ]
266 | },
267 | {
268 | "cell_type": "code",
269 | "execution_count": 19,
270 | "metadata": {},
271 | "outputs": [
272 | {
273 | "data": {
274 | "text/html": [
275 | "jonathan\r",
276 | "
"
277 | ]
278 | },
279 | "metadata": {},
280 | "output_type": "display_data"
281 | }
282 | ],
283 | "source": [
284 | "sys | get host.sessions | ^echo $it"
285 | ]
286 | },
287 | {
288 | "cell_type": "markdown",
289 | "metadata": {},
290 | "source": [
291 | "If this looks very similar to what we had before, you have a keen eye! It is similar, but with one important difference: we've called `^echo` with the value we saw earlier. This allows us to pass data out of Nu into `echo` (or any command outside of Nu, like `git` for example).\n",
292 | "\n",
293 | "*Note: help text for any of Nu's builtin commands can be discovered with the `help` command*:"
294 | ]
295 | },
296 | {
297 | "cell_type": "code",
298 | "execution_count": 20,
299 | "metadata": {},
300 | "outputs": [
301 | {
302 | "data": {
303 | "text/html": [
304 | "Configuration management.
Usage:
> config {flags}
Flags:
-h, --help: Display this help message
-l, --load <file path>: load the config from the path given
-s, --set <any>: set a value in the config, eg) --set [key value]
-i, --set_into <string>: sets a variable from values in the pipeline
-g, --get <any>: get a value from the config
-r, --remove <any>: remove a value from the config
-c, --clear: clear the config
-p, --path: return the path to the config file
Examples:
See all config values
> \u001b[1;36mconfig\u001b[0m
Set completion_mode to circular
> \u001b[1;36mconfig\u001b[0m\u001b[37m \u001b[0m\u001b[1;34m--set\u001b[0m\u001b[37m [\u001b[0m\u001b[32mcompletion_mode\u001b[0m\u001b[37m \u001b[0m\u001b[32mcircular\u001b[0m\u001b[37m]\u001b[0m
Store the contents of the pipeline as a path
> \u001b[1;36mecho\u001b[0m\u001b[37m [\u001b[0m\u001b[32m'/usr/bin'\u001b[0m\u001b[37m \u001b[0m\u001b[32m'/bin'\u001b[0m\u001b[37m] | \u001b[0m\u001b[1;36mconfig\u001b[0m\u001b[37m \u001b[0m\u001b[1;34m--set_into\u001b[0m\u001b[37m \u001b[0m\u001b[32mpath\u001b[0m
Get the current startup commands
> \u001b[1;36mconfig\u001b[0m\u001b[37m \u001b[0m\u001b[1;34m--get\u001b[0m\u001b[37m \u001b[0m\u001b[32mstartup\u001b[0m
Remove the startup commands
> \u001b[1;36mconfig\u001b[0m\u001b[37m \u001b[0m\u001b[1;34m--remove\u001b[0m\u001b[37m \u001b[0m\u001b[32mstartup\u001b[0m
Clear the config (be careful!)
> \u001b[1;36mconfig\u001b[0m\u001b[37m \u001b[0m\u001b[1;34m--clear\u001b[0m
Get the path to the current config file
> \u001b[1;36mconfig\u001b[0m\u001b[37m \u001b[0m\u001b[1;34m--path\u001b[0m
"
305 | ]
306 | },
307 | "metadata": {},
308 | "output_type": "display_data"
309 | }
310 | ],
311 | "source": [
312 | "help config"
313 | ]
314 | },
315 | {
316 | "cell_type": "code",
317 | "execution_count": null,
318 | "metadata": {},
319 | "outputs": [],
320 | "source": []
321 | }
322 | ],
323 | "metadata": {
324 | "kernelspec": {
325 | "display_name": "Nushell",
326 | "language": "",
327 | "name": "nu_jupyter"
328 | },
329 | "language_info": {
330 | "file_extension": ".txt",
331 | "mimetype": "text/plain",
332 | "name": "Any text"
333 | }
334 | },
335 | "nbformat": 4,
336 | "nbformat_minor": 4
337 | }
338 |
--------------------------------------------------------------------------------