diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000000..a858512a5cd --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,26 @@ +name: Github Pages Deployment + +on: + push: + branches: + - master + +jobs: + deploy: + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + + - name: Setup Node + uses: actions/setup-node@v2-beta + with: + node-version: '12' + + - run: npm install + - run: npm run build + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./.vuepress/dist diff --git a/.gitignore b/.gitignore new file mode 100755 index 00000000000..89b973ec4ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +node_modules +.vuepress/dist/ +npm-debug.log +.DS_Store diff --git a/.vuepress/components/BlogPosts.vue b/.vuepress/components/BlogPosts.vue new file mode 100644 index 00000000000..420bec22633 --- /dev/null +++ b/.vuepress/components/BlogPosts.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/.vuepress/config.js b/.vuepress/config.js new file mode 100755 index 00000000000..af6445d35b2 --- /dev/null +++ b/.vuepress/config.js @@ -0,0 +1,278 @@ +module.exports = { + base: "/nushell_website/", + locales: { + "/": { + lang: "English", + title: "NuShell", + description: "A new type of shell.", + }, + "/es/": { + lang: "es", + title: "NuShell", + description: "Un nuevo tipo de caparazón.", + }, + "/ja/": { + lang: "ja", + title: "NuShell", + description: "新しいタイプのシェル。.", + }, + "/pt-BR/": { + lang: "pt-BR", + title: "NuShell", + description: "Um novo tipo de concha.", + }, + "/zh-cn/": { + lang: "zh-cn", + title: "NuShell", + description: "一种新型的外壳。.", + }, + }, + head: [ + ["meta", { name: "theme-color", content: "#3eaf7c" }], + ["meta", { name: "apple-mobile-web-app-capable", content: "yes" }], + [ + "meta", + { name: "apple-mobile-web-app-status-bar-style", content: "black" }, + ], + ["link", { rel: "icon", href: "/icon.png" }], + ], + themeConfig: { + repo: "nushell/nushell", + repoLabel: "GitHub", + editLinks: true, + docsDir: "docs", + lastUpdated: false, + locales: { + "/": { + selectText: "Languages", + label: "English", + editLinkText: "Edit this page on GitHub", + nav: [ + { text: "Book", link: "/book/" }, + { text: "Contributor Book", link: "/contributor-book/" }, + { text: "Cookbook", link: "/cookbook/" }, + { text: "Blog", link: "/blog/" }, + ], + sidebar: { + "/book/": [ + { + title: "Nu Book", + collapsable: false, + children: [ + "installation", + "introduction", + "moving_around", + "types_of_data", + "loading_data", + "working_with_tables", + "pipeline", + "configuration", + "aliases", + "math", + "environment", + "metadata", + "shells_in_shells", + "escaping", + "plugins", + "coming_from_bash", + "nushell_map", + "nushell_map_imperative", + "nushell_map_functional", + "nushell_operator_map", + ], + }, + ], + "/contributor-book/": [ + { + title: "Contributor Book", + collapsable: false, + children: [ + "introduction", + "philosophy", + "values", + "commands", + "streams", + "metadata", + "plugins", + "shells", + ], + }, + ], + "/cookbook/": [ + { + title: "Cookbook", + collapsable: false, + children: [ + "setup", + "help", + "system", + "parsing", + "native_shell_programs", + "files", + "git", + "parsing_git_log", + "http", + "misc", + ], + }, + ], + }, + }, + "/es/": { + selectText: "Idiomas", + label: "Español", + editLinkText: "Edita esta página en GitHub", + nav: [ + { text: "Libro", link: "/es/book/" }, + { text: "Libro Colaborador", link: "/es/contributor-book/" }, + ], + sidebar: { + "/es/book/": [ + { + title: "Nu Libro", + collapsable: false, + children: [ + "instalacion", + "introduccion", + "explorando", + "tipos_de_datos", + "cargando_datos", + "trabajando_con_tablas", + "pipeline", + "configuracion", + "aliases", + "matematicas", + "entorno", + "metadatos", + "shells_en_shells", + "escapando", + "plugins", + "llegando_de_bash", + "mapa_nushell", + "mapa_imperativo_nushell", + "mapa_funcional_nushell", + "mapa_operador_nushell", + ], + }, + ], + "/es/contributor-book/": [ + { + title: "Contributor Book", + collapsable: false, + children: [ + "introduccion", + "filosofia", + "valores", + "comandos", + "metadatos", + ], + }, + ], + }, + }, + "/ja/": { + selectText: "言語", + label: "日本語", + editLinkText: "GitHubでこのページを編集する", + nav: [{ text: "本", link: "/ja/book/" }], + sidebar: { + "/ja/book/": [ + { + title: "Nu 本", + collapsable: false, + children: [ + "installation", + "introduction", + "moving_around", + "types_of_data", + "loading_data", + "working_with_tables", + "pipeline", + "configuration", + "metadata", + "shells_in_shells", + "escaping", + "plugins", + ], + }, + ], + }, + }, + "/pt-BR/": { + selectText: "Línguas", + label: "Português do Brasil", + editLinkText: "Edite esta página no GitHub", + nav: [ + { text: "Livro", link: "/pt-BR/book/" }, + { text: "Livro de Contribuidor", link: "/pt-BR/contributor-book/" }, + ], + sidebar: { + "/pt-BR/book/": [ + { + title: "Nu Livro", + collapsable: false, + children: [ + "instalacao", + "introducao", + "explorando", + "tipos_de_dados", + "carregando_dados", + "trabalhando_com_tabelas", + "pipeline", + "metadados", + "shells_em_shells", + "escapando", + "plugins", + ], + }, + ], + "/pt-BR/contributor-book/": [ + { + title: "Contributor Book", + collapsable: false, + children: [ + "introdução", + "filosofia", + "valores", + "comandos", + "streams", + "metadados", + "plugins", + "shells", + ], + }, + ], + }, + }, + "/zh-cn/": { + selectText: "语言", + label: "中文", + editLinkText: "在GitHub上编辑此页面", + nav: [{ text: "书", link: "/zh-CN/book/" }], + sidebar: { + "/zh-cn/book/": [ + { + title: "Nu 书", + collapsable: false, + children: [ + "installation", + "introduction", + "moving_around", + "types_of_data", + "loading_data", + "working_with_tables", + "pipeline", + "configuration", + "aliases", + "math", + "environment", + "metadata", + ], + }, + ], + }, + }, + }, + }, + plugins: ["@vuepress/plugin-back-to-top", "@vuepress/plugin-medium-zoom"], +}; diff --git a/.vuepress/enhanceApp.js b/.vuepress/enhanceApp.js new file mode 100755 index 00000000000..8452a86899d --- /dev/null +++ b/.vuepress/enhanceApp.js @@ -0,0 +1,14 @@ +/** + * Client app enhancement file. + * + * https://v1.vuepress.vuejs.org/guide/basic-config.html#app-level-enhancements + */ + +export default ({ + Vue, // the version of Vue being used in the VuePress app + options, // the options for the root Vue instance + router, // the router instance for the app + siteData // site metadata +}) => { + // ...apply enhancements for the site. +} diff --git a/.vuepress/public/icon.png b/.vuepress/public/icon.png new file mode 100644 index 00000000000..a3da491b874 Binary files /dev/null and b/.vuepress/public/icon.png differ diff --git a/.vuepress/styles/index.styl b/.vuepress/styles/index.styl new file mode 100755 index 00000000000..e69de29bb2d diff --git a/.vuepress/styles/palette.styl b/.vuepress/styles/palette.styl new file mode 100755 index 00000000000..ebd6cd4de78 --- /dev/null +++ b/.vuepress/styles/palette.styl @@ -0,0 +1,4 @@ +$accentColor = #3eaf7c +$textColor = #2c3e50 +$borderColor = #eaecef +$codeBgColor = #282c34 diff --git a/.vuepress/theme/index.js b/.vuepress/theme/index.js new file mode 100644 index 00000000000..0fe3d63fe10 --- /dev/null +++ b/.vuepress/theme/index.js @@ -0,0 +1,3 @@ +module.exports = { + extend: "@vuepress/theme-default", +}; diff --git a/.vuepress/theme/layouts/Layout.vue b/.vuepress/theme/layouts/Layout.vue new file mode 100644 index 00000000000..bfac5c66c0f --- /dev/null +++ b/.vuepress/theme/layouts/Layout.vue @@ -0,0 +1,15 @@ + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100755 index 00000000000..27283a58fc3 --- /dev/null +++ b/README.md @@ -0,0 +1,48 @@ +--- +home: true +heroImage: null +heroText: NuShell +tagline: A new type of shell. +actionText: Get Started → +actionLink: /book/ +features: + - title: Control your system with powerful pipelines + details: Pipelines let you command your system like never before. Your system belongs to you, and it awaits your command. + - title: Everything is data. + details: Rather than having the need to remember all the parameters to all the commands, we can just use the same, regardless of where it came from. + - title: Powerful Plugins + details: Nu can't come with everything you might want to do with it, so you can extend using its powerful plugin system. +footer: If you have suggestions or want to change something please give us feedback + +--- +### Quick Install + +#### Install Latest Version + +Install the latest version from the [releases page](https://github.com/nushell/nushell/releases) + +From source on [crates.io](https://crates.io): + +```sh +$ cargo install nu +``` + +#### Install via Package Manager + +With [Homebrew](https://brew.sh/): + +```sh +$ brew install nushell +``` + +With [Scoop](https://scoop.sh): + +```powershell +$ scoop install nu +``` + +#### Start the shell + +``` +$ nu +``` \ No newline at end of file diff --git a/assets/images/0_12_0_jupyter.png b/assets/images/0_12_0_jupyter.png new file mode 100644 index 00000000000..5bea11087a4 Binary files /dev/null and b/assets/images/0_12_0_jupyter.png differ diff --git a/assets/images/0_14_0_help_examples.png b/assets/images/0_14_0_help_examples.png new file mode 100644 index 00000000000..12f33575040 Binary files /dev/null and b/assets/images/0_14_0_help_examples.png differ diff --git a/assets/images/0_15_0_prettier_errors.png b/assets/images/0_15_0_prettier_errors.png new file mode 100644 index 00000000000..52c9a484233 Binary files /dev/null and b/assets/images/0_15_0_prettier_errors.png differ diff --git a/assets/images/0_16_0_after_table.png b/assets/images/0_16_0_after_table.png new file mode 100644 index 00000000000..4be269b7038 Binary files /dev/null and b/assets/images/0_16_0_after_table.png differ diff --git a/assets/images/0_16_0_before_table.png b/assets/images/0_16_0_before_table.png new file mode 100644 index 00000000000..4faf3ea7257 Binary files /dev/null and b/assets/images/0_16_0_before_table.png differ diff --git a/assets/images/0_16_0_prompt_3.png b/assets/images/0_16_0_prompt_3.png new file mode 100644 index 00000000000..776c57ee0f4 Binary files /dev/null and b/assets/images/0_16_0_prompt_3.png differ diff --git a/assets/images/0_16_0_prompt_4.png b/assets/images/0_16_0_prompt_4.png new file mode 100644 index 00000000000..050409801f0 Binary files /dev/null and b/assets/images/0_16_0_prompt_4.png differ diff --git a/assets/images/0_16_0_rendering_time.png b/assets/images/0_16_0_rendering_time.png new file mode 100644 index 00000000000..648607496ed Binary files /dev/null and b/assets/images/0_16_0_rendering_time.png differ diff --git a/assets/images/0_17_0_playground.png b/assets/images/0_17_0_playground.png new file mode 100644 index 00000000000..9650ef24ed9 Binary files /dev/null and b/assets/images/0_17_0_playground.png differ diff --git a/assets/images/0_19_autocomplete.gif b/assets/images/0_19_autocomplete.gif new file mode 100644 index 00000000000..b6e2f3b5cc5 Binary files /dev/null and b/assets/images/0_19_autocomplete.gif differ diff --git a/assets/images/0_19_heart_theme.png b/assets/images/0_19_heart_theme.png new file mode 100644 index 00000000000..4d1e41c7d55 Binary files /dev/null and b/assets/images/0_19_heart_theme.png differ diff --git a/assets/images/0_19_table_colors.png b/assets/images/0_19_table_colors.png new file mode 100644 index 00000000000..fa6cf68b1f0 Binary files /dev/null and b/assets/images/0_19_table_colors.png differ diff --git a/assets/images/0_21_bar_charts.gif b/assets/images/0_21_bar_charts.gif new file mode 100644 index 00000000000..18853998297 Binary files /dev/null and b/assets/images/0_21_bar_charts.gif differ diff --git a/assets/images/0_21_line_chart.png b/assets/images/0_21_line_chart.png new file mode 100644 index 00000000000..17b061ac4ee Binary files /dev/null and b/assets/images/0_21_line_chart.png differ diff --git a/assets/images/0_22_flatten.gif b/assets/images/0_22_flatten.gif new file mode 100644 index 00000000000..188a3dd5e80 Binary files /dev/null and b/assets/images/0_22_flatten.gif differ diff --git a/assets/images/0_4_0_new_colors.png b/assets/images/0_4_0_new_colors.png new file mode 100644 index 00000000000..5626ae6b5f9 Binary files /dev/null and b/assets/images/0_4_0_new_colors.png differ diff --git a/assets/images/0_4_0_streaming_table.gif b/assets/images/0_4_0_streaming_table.gif new file mode 100644 index 00000000000..486e9cd43d9 Binary files /dev/null and b/assets/images/0_4_0_streaming_table.gif differ diff --git a/assets/images/0_6_0_starship_prompt.png b/assets/images/0_6_0_starship_prompt.png new file mode 100644 index 00000000000..d3ffc6241c8 Binary files /dev/null and b/assets/images/0_6_0_starship_prompt.png differ diff --git a/assets/images/0_9_0_error_highlight.png b/assets/images/0_9_0_error_highlight.png new file mode 100644 index 00000000000..83f10f424e0 Binary files /dev/null and b/assets/images/0_9_0_error_highlight.png differ diff --git a/assets/images/default.png b/assets/images/default.png new file mode 100644 index 00000000000..133dd1cdc58 Binary files /dev/null and b/assets/images/default.png differ diff --git a/assets/images/did_you_mean.png b/assets/images/did_you_mean.png new file mode 100644 index 00000000000..a73d16cb106 Binary files /dev/null and b/assets/images/did_you_mean.png differ diff --git a/assets/images/happy_nu_year_2020.png b/assets/images/happy_nu_year_2020.png new file mode 100644 index 00000000000..c2325f980c1 Binary files /dev/null and b/assets/images/happy_nu_year_2020.png differ diff --git a/assets/images/jonathandturner.jpg b/assets/images/jonathandturner.jpg new file mode 100644 index 00000000000..e357e24855c Binary files /dev/null and b/assets/images/jonathandturner.jpg differ diff --git a/assets/images/link.png b/assets/images/link.png new file mode 100644 index 00000000000..a3da491b874 Binary files /dev/null and b/assets/images/link.png differ diff --git a/assets/images/nu_error.png b/assets/images/nu_error.png new file mode 100644 index 00000000000..f8500fd867f Binary files /dev/null and b/assets/images/nu_error.png differ diff --git a/assets/images/nu_error2.png b/assets/images/nu_error2.png new file mode 100644 index 00000000000..6ba11814411 Binary files /dev/null and b/assets/images/nu_error2.png differ diff --git a/assets/images/nu_error_metadata.png b/assets/images/nu_error_metadata.png new file mode 100644 index 00000000000..77f780a7508 Binary files /dev/null and b/assets/images/nu_error_metadata.png differ diff --git a/assets/images/nu_logo.png b/assets/images/nu_logo.png new file mode 100644 index 00000000000..2193278eee6 Binary files /dev/null and b/assets/images/nu_logo.png differ diff --git a/assets/images/nu_ls.png b/assets/images/nu_ls.png new file mode 100644 index 00000000000..58b7838849f Binary files /dev/null and b/assets/images/nu_ls.png differ diff --git a/assets/images/nu_ls_filter.png b/assets/images/nu_ls_filter.png new file mode 100644 index 00000000000..4f0c2f6a5de Binary files /dev/null and b/assets/images/nu_ls_filter.png differ diff --git a/assets/images/nu_ps_filter.png b/assets/images/nu_ps_filter.png new file mode 100644 index 00000000000..924d299a9b0 Binary files /dev/null and b/assets/images/nu_ps_filter.png differ diff --git a/assets/images/nushell-autocomplete4.gif b/assets/images/nushell-autocomplete4.gif new file mode 100644 index 00000000000..280bfcacada Binary files /dev/null and b/assets/images/nushell-autocomplete4.gif differ diff --git a/assets/images/nushell_survey_2019_anything_else.png b/assets/images/nushell_survey_2019_anything_else.png new file mode 100644 index 00000000000..44316f7ca3e Binary files /dev/null and b/assets/images/nushell_survey_2019_anything_else.png differ diff --git a/assets/images/nushell_survey_2019_blockers.png b/assets/images/nushell_survey_2019_blockers.png new file mode 100644 index 00000000000..a7aab1ba0b6 Binary files /dev/null and b/assets/images/nushell_survey_2019_blockers.png differ diff --git a/assets/images/nushell_survey_2019_fave_features.png b/assets/images/nushell_survey_2019_fave_features.png new file mode 100644 index 00000000000..9ac05aad11a Binary files /dev/null and b/assets/images/nushell_survey_2019_fave_features.png differ diff --git a/assets/images/nushell_survey_2019_needs_work.png b/assets/images/nushell_survey_2019_needs_work.png new file mode 100644 index 00000000000..f7b9f071624 Binary files /dev/null and b/assets/images/nushell_survey_2019_needs_work.png differ diff --git a/assets/images/nushell_survey_2019_percent.png b/assets/images/nushell_survey_2019_percent.png new file mode 100644 index 00000000000..b522522443f Binary files /dev/null and b/assets/images/nushell_survey_2019_percent.png differ diff --git a/assets/images/nushell_survey_2019_stoppers.png b/assets/images/nushell_survey_2019_stoppers.png new file mode 100644 index 00000000000..d3164d087b8 Binary files /dev/null and b/assets/images/nushell_survey_2019_stoppers.png differ diff --git a/assets/images/open_cargo.png b/assets/images/open_cargo.png new file mode 100644 index 00000000000..546d76bc1b8 Binary files /dev/null and b/assets/images/open_cargo.png differ diff --git a/assets/images/utf8_light_table.png b/assets/images/utf8_light_table.png new file mode 100644 index 00000000000..718c1cece7e Binary files /dev/null and b/assets/images/utf8_light_table.png differ diff --git a/assets/images/utf8_table.png b/assets/images/utf8_table.png new file mode 100644 index 00000000000..d092eb0d5e2 Binary files /dev/null and b/assets/images/utf8_table.png differ diff --git a/assets/images/view_source.png b/assets/images/view_source.png new file mode 100644 index 00000000000..8336dd12b9b Binary files /dev/null and b/assets/images/view_source.png differ diff --git a/assets/images/year_1_kloc.png b/assets/images/year_1_kloc.png new file mode 100644 index 00000000000..9c3f9d9cdd3 Binary files /dev/null and b/assets/images/year_1_kloc.png differ diff --git a/blog/2019-08-23-introducing-nushell.md b/blog/2019-08-23-introducing-nushell.md new file mode 100644 index 00000000000..0d065f14599 --- /dev/null +++ b/blog/2019-08-23-introducing-nushell.md @@ -0,0 +1,327 @@ +--- +title: Introducing nushell +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: Today, we're introducing a new shell, written in Rust. It draws inspiration from the classic Unix philosophy of pipelines, the structured data approach of PowerShell, functional programming, systems programming, and more. +--- + +# Introducing nushell + +Today, we're introducing a new shell, written in Rust. It draws inspiration from the classic Unix philosophy of pipelines, the structured data approach of PowerShell, functional programming, systems programming, and more. + +It's called Nushell, or just Nu for short. We have a [book](https://book.nushell.sh/en) (¡también se habla [Español](https://book.nushell.sh/es)!). We have a [repo](https://github.com/nushell/nushell). + +This release was made by Jonathan Turner (me), Yehuda Katz, and Andrés Robalino, with contributions from Odin Dutton. + +![Nu in action](../assets/images/nushell-autocomplete4.gif) + +# But why? + +Many of us have gotten used to bash (or zsh/fish/etc), and don't understand why you would need another kind of shell. That was me, too, a few months ago before I started working on this. My friend Yehuda had discovered PowerShell and was going on and on about how amazing it was to do more with the shell, but until he actually gave me a demo, I didn't really believe him. + +Then he talked me into joining him on an idea he had. What if we could take the ideas of a structured shell and make it more functional (as opposed to object-oriented)? What if, like PowerShell, it worked on Windows, Linux, and macOS? What if it had great error messages? I fell in love with the project ideas, made a few new friends, and many nights and weekends later I'd like to show you what we've made. + +In this post, I'll talk about how a few simple ideas drive how Nu works, what Nu can do with them, and where we hope to go in the future. + +# Simple ideas + +To Nu, everything is data. When you type `ls`, you're given a table of information about the directory you're listing: + +![ls command](../assets/images/nu_ls.png) + +Rather than having to remember different flags to `ls`, we can just work with the data it gives back. We can find the files greater than a certain size: + +![ls with filtering](../assets/images/nu_ls_filter.png) + +Or we could choose to sort it by a column, or only show directories, or more. That by itself is fun but perhaps not compelling enough. + +![ps with filtering](../assets/images/nu_ps_filter.png) + +Where this simple concept - that everything in Nu is data - starts to shine when we try other commands and realize that we're using the same commands to filter, to sort, etc. Rather than having the need to remember all the parameters to all the commands, we can just use the same verbs to act over our data, regardless of where the data came from. Nu pushes this idea even further. + +![opening toml file](../assets/images/open_cargo.png) + +Nu also understands structured text files like JSON, TOML, YAML, and more. Opening these files gives us the same tables we saw with `ls` and `ps`. Again, this lets us use the same commands to filter our data, explore it, and use it. + +# Working with the outside world + +The above approach could be fun, but if we're not careful, it could become a walled garden. What happens outside of the commands Nu comes with? + +First, let's take a look at working with a file that Nu doesn't understand. + +``` +> open people.psv +Octavia | Butler | Writer +Bob | Ross | Painter +Antonio | Vivaldi | Composer +``` + +To work with this in Nu, we need to do two steps: figure out where the rows are, and then figure out what the columns are. The rows are pretty easy, we just have one record per row: + +``` +> open people.psv | lines +---+------------------------------ + # | value +---+------------------------------ + 0 | Octavia | Butler | Writer + 1 | Bob | Ross | Painter + 2 | Antonio | Vivaldi | Composer +---+------------------------------ +``` + +Next, we can create our columns by splitting each row at the pipe (`|`) symbol: + +``` +> open people.psv | lines | split-column "|" +---+----------+-----------+----------- + # | Column1 | Column2 | Column3 +---+----------+-----------+----------- + 0 | Octavia | Butler | Writer + 1 | Bob | Ross | Painter + 2 | Antonio | Vivaldi | Composer +---+----------+-----------+----------- +``` + +That's already good enough that we can work with the data. We can go a step further and name the columns if we want: + +``` +> open people.psv | lines | split-column " | " firstname lastname job +---+-----------+----------+---------- + # | firstname | lastname | job +---+-----------+----------+---------- + 0 | Octavia | Butler | Writer + 1 | Bob | Ross | Painter + 2 | Antonio | Vivaldi | Composer +---+-----------+----------+---------- +``` + +But what about working with commands outside of Nu? Let's first call the native version of `ls` instead of the Nu version: + +``` +> ^ls +assets Cargo.lock docs images Makefile.toml README.md rustfmt2.toml src tests +Cargo2.toml Cargo.toml extra LICENSE open readonly.txt rustfmt.toml target +``` + +We'll use the same commands we used on data to bring it into Nu: + +``` +^ls | split-row " " file +----+--------------- + # | value +----+--------------- + 0 | assets + 1 | Cargo2.toml + 2 | Cargo.lock + 3 | Cargo.toml + 4 | docs + 5 | extra + 6 | images + 7 | LICENSE + 8 | Makefile.toml + 9 | open + 10 | README.md + 11 | readonly.txt + 12 | rustfmt2.toml + 13 | rustfmt.toml + 14 | src + 15 | target + 16 | tests +----+--------------- +``` + +Or maybe we want to work with the native `ls -la`: + +``` +^ls -la | lines | split-column " " +----+------------+---------+----------+----------+---------+---------+---------+---------+--------------- + # | Column1 | Column2 | Column3 | Column4 | Column5 | Column6 | Column7 | Column8 | Column9 +----+------------+---------+----------+----------+---------+---------+---------+---------+--------------- + 0 | total | 296 | | | | | | | + 1 | drwxr-xr-x | 13 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | . + 2 | drwxr-xr-x | 21 | jonathan | jonathan | 4096 | Aug | 22 | 17:00 | .. + 3 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Aug | 3 | 05:39 | assets + 4 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Aug | 21 | 19:29 | .azure + 5 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Jun | 23 | 05:09 | .cargo + 6 | -rw-r--r-- | 1 | jonathan | jonathan | 2963 | Aug | 22 | 20:17 | Cargo2.toml + 7 | -rw-r--r-- | 1 | jonathan | jonathan | 201255 | Aug | 24 | 03:24 | Cargo.lock + 8 | -rw-r--r-- | 1 | jonathan | jonathan | 3127 | Aug | 24 | 03:24 | Cargo.toml + 9 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Jun | 17 | 15:32 | docs + 10 | -rw-r--r-- | 1 | jonathan | jonathan | 148 | Jun | 17 | 15:32 | .editorconfig + 11 | drwxr-xr-x | 4 | jonathan | jonathan | 4096 | Aug | 22 | 19:29 | extra + 12 | drwxr-xr-x | 8 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | .git + 13 | -rw-r--r-- | 1 | jonathan | jonathan | 58 | Aug | 10 | 11:08 | .gitignore + 14 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | images + 15 | -rw-r--r-- | 1 | jonathan | jonathan | 1085 | Jun | 17 | 15:32 | LICENSE + 16 | -rw-r--r-- | 1 | jonathan | jonathan | 614 | Jun | 17 | 15:32 | Makefile.toml + 17 | -rw-r--r-- | 1 | jonathan | jonathan | 0 | Aug | 23 | 04:58 | open + 18 | -rw-r--r-- | 1 | jonathan | jonathan | 11375 | Aug | 24 | 03:24 | README.md + 19 | -r--r--r-- | 1 | jonathan | jonathan | 0 | Jul | 4 | 03:51 | readonly.txt + 20 | -rw-r--r-- | 1 | jonathan | jonathan | 37 | Aug | 23 | 04:54 | rustfmt2.toml + 21 | -rw-r--r-- | 1 | jonathan | jonathan | 16 | Aug | 1 | 19:45 | rustfmt.toml + 22 | drwxr-xr-x | 10 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | src + 23 | drwxr-xr-x | 4 | jonathan | jonathan | 4096 | Aug | 22 | 19:22 | target + 24 | drwxr-xr-x | 4 | jonathan | jonathan | 4096 | Aug | 22 | 04:15 | tests + 25 | drwxrwxr-x | 2 | jonathan | jonathan | 4096 | Jul | 19 | 15:18 | .vscode +----+------------+---------+----------+----------+---------+---------+---------+---------+--------------- +``` + +After a bit of experimenting, we might come up with a command like this: + +``` +> ^ls -la | lines | skip 1 | split-column " " perms files group user size month day time name +----+------------+-------+----------+----------+--------+-------+-----+-------+--------------- + # | perms | files | group | user | size | month | day | time | name +----+------------+-------+----------+----------+--------+-------+-----+-------+--------------- + 0 | drwxr-xr-x | 13 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | . + 1 | drwxr-xr-x | 21 | jonathan | jonathan | 4096 | Aug | 22 | 17:00 | .. + 2 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Aug | 3 | 05:39 | assets + 3 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Aug | 21 | 19:29 | .azure + 4 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Jun | 23 | 05:09 | .cargo + 5 | -rw-r--r-- | 1 | jonathan | jonathan | 2963 | Aug | 22 | 20:17 | Cargo2.toml + 6 | -rw-r--r-- | 1 | jonathan | jonathan | 201255 | Aug | 24 | 03:24 | Cargo.lock + 7 | -rw-r--r-- | 1 | jonathan | jonathan | 3127 | Aug | 24 | 03:24 | Cargo.toml + 8 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Jun | 17 | 15:32 | docs + 9 | -rw-r--r-- | 1 | jonathan | jonathan | 148 | Jun | 17 | 15:32 | .editorconfig + 10 | drwxr-xr-x | 4 | jonathan | jonathan | 4096 | Aug | 22 | 19:29 | extra + 11 | drwxr-xr-x | 8 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | .git + 12 | -rw-r--r-- | 1 | jonathan | jonathan | 58 | Aug | 10 | 11:08 | .gitignore + 13 | drwxr-xr-x | 2 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | images + 14 | -rw-r--r-- | 1 | jonathan | jonathan | 1085 | Jun | 17 | 15:32 | LICENSE + 15 | -rw-r--r-- | 1 | jonathan | jonathan | 614 | Jun | 17 | 15:32 | Makefile.toml + 16 | -rw-r--r-- | 1 | jonathan | jonathan | 0 | Aug | 23 | 04:58 | open + 17 | -rw-r--r-- | 1 | jonathan | jonathan | 11375 | Aug | 24 | 03:24 | README.md + 18 | -r--r--r-- | 1 | jonathan | jonathan | 0 | Jul | 4 | 03:51 | readonly.txt + 19 | -rw-r--r-- | 1 | jonathan | jonathan | 37 | Aug | 23 | 04:54 | rustfmt2.toml + 20 | -rw-r--r-- | 1 | jonathan | jonathan | 16 | Aug | 1 | 19:45 | rustfmt.toml + 21 | drwxr-xr-x | 10 | jonathan | jonathan | 4096 | Aug | 24 | 03:24 | src + 22 | drwxr-xr-x | 4 | jonathan | jonathan | 4096 | Aug | 22 | 19:22 | target + 23 | drwxr-xr-x | 4 | jonathan | jonathan | 4096 | Aug | 22 | 04:15 | tests + 24 | drwxrwxr-x | 2 | jonathan | jonathan | 4096 | Jul | 19 | 15:18 | .vscode +----+------------+-------+----------+----------+--------+-------+-----+-------+--------------- +``` + +Because Nu let's you manipulate your data until it's how you want it, there's a feeling of playing with your data. You get used to using the verbs, and then you can use them on anything. When you're ready, you can write it back to disk. + +Oh, before I forget - I wanted to quickly show how to get data from Nu back out into the outside world. Here's an example of calling `echo` on each filename in a directory: + +``` +> ls | get name | echo $it +``` + +You can see that we can mix-and-match commands that are inside of Nu with those that are outside, and data will still flow between them as expected. But Nu is more than just a pipeline. + +# More than a pipeline + +As we built Nu, we realized we could experiment with other parts of how a shell works. The first of these experiments lead us to an observation: if everything is data in Nu, we should be able to view this data. + +![viewing source file](../assets/images/view_source.png) + +We've seen the tables. Nu also supports opening and looking at text and binary data. If we open a source file, we can scroll around in a syntax-highlighted file. If we open an xml, we can look at its data. We can even open a binary file and look at what's inside (hint: there's even a fun easter egg if you open certain kinds binary files, especially if you've installed Nu with the optional `rawkey` feature). + +Being able to view data is helpful, and this kind of polish extends to other aspects, like error messages: + +![simple error](../assets/images/nu_error2.png) + +Nu takes heavy inspiration from the [error messages in Rust](https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-come.html). As much as possible, draw your eyes to the problem. + +Combined with the pipeline, some pretty interesting errors are possible: + +![error with metadata](../assets/images/nu_error_metadata.png) + +You might wonder how does that even work. Nu has a metadata system (still early!) that you can read about in the [Metadata chapter](https://book.nushell.sh/en/metadata) of the [Nu book](https://book.nushell.sh). Let's just take a quick peek at it: + +``` +> open Cargo.toml +------------+--------------+------------------+----------+---------- + bin | dependencies | dev-dependencies | lib | package +------------+--------------+------------------+----------+---------- + [11 items] | [object] | [object] | [object] | [object] +------------+--------------+------------------+----------+---------- +> open Cargo.toml | tags +----------+------------------------------------------ + span | origin +----------+------------------------------------------ + [object] | /home/jonathan/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/jonathan/Source/rhai(master)> shells +---+---+------------+------------------------------- + # | | name | path +---+---+------------+------------------------------- + 0 | | filesystem | /home/jonathan/Source/nushell + 1 | X | filesystem | /home/jonathan/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/jonathan/Source/nushell + 1 | | filesystem | /home/jonathan/Source/rhai + 2 | X | {/home/jonathan/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 +------------+--------------+------------------+----------+---------- + [11 items] | [object] | [object] | [object] | [object] +------------+--------------+------------------+----------+---------- +/> cd bin +/bin> ls +----+----------------------+--------------------------- + # | name | path +----+----------------------+--------------------------- + 0 | nu_plugin_inc | src/plugins/inc.rs + 1 | nu_plugin_sum | src/plugins/sum.rs + 2 | nu_plugin_add | src/plugins/add.rs + 3 | nu_plugin_edit | src/plugins/edit.rs + 4 | nu_plugin_str | src/plugins/str.rs + 5 | nu_plugin_skip | src/plugins/skip.rs + 6 | nu_plugin_sys | src/plugins/sys.rs + 7 | nu_plugin_tree | src/plugins/tree.rs + 8 | nu_plugin_binaryview | src/plugins/binaryview.rs + 9 | nu_plugin_textview | src/plugins/textview.rs + 10 | nu | src/main.rs +----+----------------------+--------------------------- +``` + +# Plugins + +Nu can't come with everything you might want to do with it, so we're releasing Nu with the ability to extend it with plugins. There's more information in the [plugins chapters](https://book.nushell.sh/en/plugins). Nu will look for these plugins in your path, and load them up on startup. + +# All because of Rust + +Nu would not have been possible without Rust. Internally, it uses async/await, async streams, and liberal use of "serde" to manage serializing and deserializing into the common data format and to communicate with plugins. + +We also heavily leveraged [crates.io](https://crates.io). The ability to load numerous file formats, display messages, draw tables, and more all came from the hundreds (thousands?) of generous developers who wrote the crates we use in Nu. A **huge** thank you to everyone who contributed to Nu without ever knowing it. + +# What's next? + +Nu is just getting started. In this release, we have a foundation to build on. Next, we'll work towards stability, the abilty to use Nu as your main shell, the ability to write functions and scripts in Nu, and much more. + +If you want to give it a spin, the [installation instructions](https://book.nushell.sh/en/installation) will help you get started. If you want to chat come by our [discord](https://discord.gg/NtAbbGn) and [github](https://github.com/nushell/nushell) diff --git a/blog/2019-09-24-nushell_0_3_0.md b/blog/2019-09-24-nushell_0_3_0.md new file mode 100644 index 00000000000..f8d466ec5a0 --- /dev/null +++ b/blog/2019-09-24-nushell_0_3_0.md @@ -0,0 +1,91 @@ +--- +title: Nushell 0.3.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: We're happy to announce that today we're releasing Nushell 0.3.0. Nu has seen numerous bugfixes, performance improvements, and features added since its initial public release (which was only a few weeks ago!) +--- + +# Nushell 0.3.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're happy to announce that today we're releasing Nushell 0.3.0. Nu has seen numerous bugfixes, performance improvements, and features added since its initial public release (which was only a few weeks ago!) + +# Where to get it + +Nu 0.3.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.3.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo +nightly install nu` (or if you want all the features `cargo +nightly install nu --all-features`). + +# What's new + +## New table design (Porges, jonathandturner) + +![Table with utf8 box drawing](../assets/images/utf8_table.png) + +One of the most striking differences is that Nu now uses UTF-8 box drawing to draw its tables. + +![Table with utf8 box drawing in light mode](../assets/images/utf8_light_table.png) + +The table is also configurable. If you feel like the table is a bit too heavy, you can also configure it to work in light mode using this command: + +``` +> config --set [table_mode light] +``` + +## New file formats (pmeredit, est31, andrasio, jonathandturner) + +Nu now natively supports new file formats, including: bson, tsv, sqlite, and url-encoded strings. + +## New commands (incrop, ramonsnir, ijt, jonathandturner, andrasio, JonnyWalker81, chhetripradeep, pka) + +Since the 0.2.0 release, Nu has gained a set of additional commands, including: +* `help` - built-in help system +* `reverse` - reverse a table +* `last` - like the `first` command, but working from the bottom of the table, return n rows +* `embed` - create a new table using the current table as a start +* `fetch` - get the contents of a URL (this originally lived in `open`) +* `post` - post to a URL and get the results +* `pwd` - print the working directory +* `env` - give access to a number of important paths and environment settings +* `pivot` - pivot a table so that rows become columns and vice-versa +* `echo` - a built-in echo command + +## Error improvements (jonathandturner) + +![Improve error messages](../assets/images/did_you_mean.png) + +We've made steady progress on improving error messages. Recently, we added "did you mean?" errors to help when you mistype the name of columns. Nu 0.3.0 also has gone through a few passes to generally polish the errors to include more information when an error occurs. + +## Shell features (pka, wycats, twe4ked, andrasio, iamcodemaker) + +Nu now supports `~` to refer to your home directory as part of a path. You can also use `cd -` to return to a previous directory you were working in. + +The shell itself also got a few updates. You can now enable 'vi' mode, if you'd prefer vi-like bindings (by running `config --set [edit_mode vi]`). On non-Windows platforms, you can also use Ctrl-R to enable Sublime-style history searching (we're hoping to enable Windows support for this soon). + +## Plugin improvements (jonathandturner, andrasio) + +Plugins have continued to mature, and it's now possible to use plugins to extend Nu with support for new file formats. + +We've also added documentation on how to [write Nu plugins in both Rust and Python](https://github.com/nushell/contributor-book/blob/master/en/plugins.md), with info on Ruby coming soon. + +## Docker support (vsoch, DrSensor) + +If you're interested in using Nu and Docker together, be sure to check out the [new Docker support](https://github.com/nushell/nushell/blob/master/docs/docker.md). + +## Book progress + +The [Nu book](http://book.nushell.sh) is now available in *three* languages: English, Spanish, and Japanese. + +We've also created a [Nu contributor book](https://github.com/nushell/contributor-book/blob/master/en/README.md), which will help developers who want to contribute to Nu learn about its philosophy, design, and how to create plugins. + +## Acknowledgements + +est31, pmeredit, twe4ked, DrSensor, vsoch, pka, jankoprowski, Porges, max-sixty, ijt, djc, vthriller, taiki-e, oskarskog, iamcodemaker, JonnyWalker81, yaahc, tim77, svartalf, ramonsnir, orf, lesichkovm, ineol, incrop, eoinkelly, devnought, chhetripradeep, aidanharris, GuillaumeGomez, and BatmanAod for contributing to the Nu codebase. Also a *big* thanks to our issue reporters! + +ymgyt - for the Japanese version of the Nu book! + +mistydemeo, romanlevin, ralvessa, pka, lord, kkalyan, jankprowski, and boisgera for helping with the book. + +## Looking ahead + +We're hard at work on the [upcoming milestone release](https://github.com/nushell/nushell/issues/261). If you'd like to help, feel free to jump in! We have an active [discord](https://discord.gg/NtAbbGn) you can join for both users and contributors. diff --git a/blog/2019-10-15-nushell-0_4_0.md b/blog/2019-10-15-nushell-0_4_0.md new file mode 100644 index 00000000000..6f235ec35a4 --- /dev/null +++ b/blog/2019-10-15-nushell-0_4_0.md @@ -0,0 +1,73 @@ +--- +title: Nushell 0.4.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: Today we're happy to announce the 0.4.0 release of Nushell. The 0.4.0 marks a continually maturing shell that is now starting to show signs of stability. And, of course, a few fun features along the way. +--- + +# Nushell 0.4.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today we're happy to announce the 0.4.0 release of Nushell. The [0.4.0 release](https://github.com/nushell/nushell/releases/tag/0.4.0) marks a continually maturing shell that is now starting to show signs of stability. And, of course, a few fun features along the way. + +# Where to get it + +Nu 0.4.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.4.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo +beta install nu` (or if you want all the features `cargo +beta install nu --all-features`). + +# What's new + +## New Colors (wycats) + +![Example of nushell](../assets/images/0_4_0_new_colors.png) +New colors! + +With 0.4.0, we're adding some new colors to show off different types of the command, where errors might be happening, and if the command is internal or external. The coloring is just the tip of the iceberg, as it were, and builds from a reworking of the parser to make it more accurate, more stable, and more feature-complete. + +## Streaming table (jonathandturner) + +![Animation of a long table streaming out](../assets/images/0_4_0_streaming_table.gif) +Streaming tables + +Up to this point, we've taken a few shortcuts with how streams worked in Nushell. We knew that a table, in theory, was a stream of rows. In practice, though, this wasn't the case as the code has lots of assumptions about how tables worked. + +With the 0.4.0, we're taking a big step in the direction of full support for streams. You'll see that now data will start being printed as it becomes available, with tables printing pages of 50 rows at a time (by default). This allows you to get deep listings of files (eg using `ls **`), work with streams from external sources, and more. + +## Better ctrl-c support (jonathandturner, landaire) + +As part of having streams of tables, it's always helpful to be able to say "stop!" when you need to. With 0.4.0, using ctrl-c to stop the output should be a lot more responsive and will take you back to the prompt. + +## Textview gets VI keys (JonnyWalker81) + +The built-in text viewer now lets you use vi keys for navigation thanks to JonnyWalker81's work. + +## Onto the Beta compiler (est31) + +For those of you wondering if and when Nu was going to be usable on stable Rust, you need but wait just a little longer. Contributer est31 has been hard at work at moving Nu onto stable Rust and has now successfully moved Nu off of nightly and onto beta. As beta matures and becomes the next release of Rust, we'll be able to move Nu onto stable. This should help people who are working to distribute Nu on various distributions. + +## Brazilian Portuguese book (marcelocg) + +Contributor marcelocg surprised us with a translation of the Nu book into Brazillian Portuguese. Obrigado, Marcelo! + +## New commands + +### from-ssv (t-hart) + +To follow along with our `from-csv` (comma-separated-values) and `from-tsv` (tab-separated-values), we now have a new way of handle importing content from commands that output their own tables: `from-ssv`. Like its siblings, it looks for values separated by a separator, using the spaces to show where the breaks between cells should be. + +### match (rnxpyke) + +We're continuing to evolve our support for matching string data. Recently, we began experimenting with a `match` command that can find matches in strings for you. We plan to continue experimenting and exploring what's possible in this space in the future. + +## Lots of new documentation (sdfnz, twe4ked, chhetripradeep, mfarberbrodsky, cristicismas, Charles-Schleich, coolshaurya, notryanb, pema99, gilesv, yahsinhuangtw, JesterOrNot, nalshihabi, marcelocg, sorrell, pizzafox, iggy14750, DrSensor, mlbright, BradyBromley, andrasio, piotrek-szczygiel) + +Happy hacktoberfest! Lots of people wanted to jump in and help document all of our commands, help fix docs that are already there, and generally give things a bit of polish. Much appreciated everyone who came by and contributed. + +## Tons of stability fixes (thegedge, jonathandturner, wycats, JonnyWalker81, vsoch, pka) + +As always, there were a bunch of stability and correctness both in Nu and in the CI that support Nu's development + +# Looking ahead + +We'll continuing filling out the features that will let folks use Nu as their everyday shell. Coming up are better support for the environment, path, and for command aliases. diff --git a/blog/2019-11-05-nushell-0_5_0.md b/blog/2019-11-05-nushell-0_5_0.md new file mode 100644 index 00000000000..d28d865ea33 --- /dev/null +++ b/blog/2019-11-05-nushell-0_5_0.md @@ -0,0 +1,242 @@ +--- +title: Nushell 0.5.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: Today, we're happy to announce the 0.5.0 release for Nu. We've got lots of new features, including some long-requested ones, in this release. +--- + +# Nushell 0.5.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're happy to announce the 0.5.0 release for Nu. We've got lots of new features, including some long-requested ones, in this release. + +# Where to get it + +Nu 0.5.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0_5_0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo +beta install nu` (or if you want all the features `cargo +beta install nu --all-features`). + +# Nu as a login shell (jonathandturner) + +One of the key features that landed in 0.5.0 is set of new capabilities that work together to allow you to use Nu as a login shell, completely independent of bash or other hosting shells. For this, we've built in support for querying and updating the environment variables and the path. + +To get started, you'll need to first copy the environment you're using into the config. Luckily, we've also made some improvements there: + +```shell +> config --set [path $nu:path] +> config --set [env $nu:env] +``` + +Version 0.7.2 and later (added: Dec 24, 2019) : +```shell +> config --set [path $nu.path] +> config --set [env $nu.env] +``` + +Once these values are set, you'll be able to use Nu as your login shell. + +## New variables + +As you saw above, we've added a few new built-in variables. These will let you know what the current values that Nu can see are for your environment, path, and the config itself. + +```shell +> echo $nu:env +> echo $nu:path +> echo $nu:config +``` + +Version 0.7.2 and later: + +```shell +> echo $nu.env +> echo $nu.path +> echo $nu.config +``` + + +## Adding paths to your PATH + +One of the first things you'll notice is that the new $nu:path is structured. If you run the echo above, you might see something like this: + +```shell +> echo $nu:path +━━━┯━━━━━━━━━━━━━━━━━━ + # │ +───┼────────────────── + 0 │ /usr/local/sbin + 1 │ /usr/local/bin + 2 │ /usr/sbin + 3 │ /usr/bin + 4 │ /sbin + 5 │ /bin + 6 │ /usr/games + 7 │ /usr/local/games + 8 │ /snap/bin +━━━┷━━━━━━━━━━━━━━━━━━ +``` + +Version 0.7.2 and later: + +```shell +> echo $nu.path +━━━┯━━━━━━━━━━━━━━━━━━ + # │ +───┼────────────────── + 0 │ /usr/local/sbin + 1 │ /usr/local/bin + 2 │ /usr/sbin + 3 │ /usr/bin + 4 │ /sbin + 5 │ /bin + 6 │ /usr/games + 7 │ /usr/local/games + 8 │ /snap/bin +━━━┷━━━━━━━━━━━━━━━━━━ +``` + + +We've added two new commands: `prepend` for adding items to the start of a table and `append` for adding items to the end of a table. With these commands, we can now query out the path, update it, and save it back. + +```shell +> echo $nu:path | prepend "/my/new/directory" | config --set_into path +``` + +Version 0.7.2 and later: + +```shell +> echo $nu.path | prepend "/my/new/directory" | config --set_into path +``` + +## Adding variables to your environment + +You can use a similar set of steps to add new variables, or change existing variables, in your environment. + +```shell +> echo $nu:env | insert GREETING hello_world | config --set_into env +``` + +Version 0.7.2 and later: + +```shell +> echo $nu.env | insert GREETING hello_world | config --set_into env +``` + +_Note: the previous `add` command of previous releases has been renamed `insert` to remove confusion with mathematical functions._ + +# On-going improvements + +We're continuing to improve the commands we currently ship as part of Nu. Here are a few you might find helpful: + +## Substrings (Flare576) + +The `str` command now supports being able to retrieve a substring from the strings given, so you could return, for example, the first 5 characters and stop after that. + +```shell +> ls | get name +━━━━┯━━━━━━━━━━━━━━━━━━━━ + # │ +────┼──────────────────── + 0 │ target + 1 │ CODE_OF_CONDUCT.md + 2 │ .cargo + 3 │ src + 4 │ features.toml + 5 │ rustfmt.toml +``` + +```shell +> ls | get name | str --substring "0,3" +━━━━┯━━━━━━━━━ + # │ +────┼───────── + 0 │ tar + 1 │ COD + 2 │ .ca + 3 │ src + 4 │ fea + 5 │ rus +``` + +## Recycling (jdvr) + +Ever wish you could `rm` things, but not forever? You can now tell `rm` to send items to your platform's recycle bin rather than deleting them forever. As with our other commands, this works across all the platforms that Nu supports. + +```shell +> rm myfile.txt --trash +``` + +## Parameter descriptions (jonathandturner) + +We're also continuing to improve the built-in help system. New in this release are descriptions for the flags and parameters that the command uses. For example, here's a look at what the help for `rm` now looks like: + +```shell +> help rm +Remove a file + +Usage: + > rm {flags} + +parameters: + the file path to remove + +flags: + --trash: use the recycle bin on the platform instead of permanently deleting + --recursive: delete subdirectories recursively +``` + +# New commands + +In addition to the new `append` and `prepend` we mentioned earlier, we've added a few new commands to Nu. + +## Average (notryanb) + +Growing our set of mathematics functions for working with numbers, we now have an `average` command which will take the average of values given to it. + +```shell +> ls | get size | average +``` + +## Read (jonathandturner) + +We've also introduced a new command to load in strings as tables. This new `read` command will take a pattern that describes the columns, their names, and where they are in each row of the string. + +```shell +> open .editorconfig +root = true + +[*] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = false +end_of_line = lf +``` + +```shell +> open .editorconfig | read "{variable} = {value}" +━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━ + # │ variable │ value +───┼──────────────────────────┼─────── + 0 │ root │ true + 1 │ indent_style │ space + 2 │ indent_size │ 4 + 3 │ charset │ utf-8 + 4 │ trim_trailing_whitespace │ true + 5 │ insert_final_newline │ false + 6 │ end_of_line │ lf +``` + +# Bugfixes (jonathandturner, JesterOrNot, thegedge, andrasio, wycats, notryanb, Detegr, t-hart) + +As always, we've had lots of bugfixes. A *huge* "thank you!" to folks who reported issues, fixed issues, and just generally shared their experience with the shell. It's much appreciated and helps to continue making Nu that much better. + +# Survey + +If you haven't already taken it, we'd love to hear your feedback in a quick (roughly 3 question) [survey](https://t.co/nujSjnI0dr?amp=1). + +# Looking forward + +There are a bunch of areas we're currently working on to make Nu more stable and feature complete. Until this work is finished, please consider Nu to be somewhere in the *pre-alpha* to *alpha* quality level. + +That said, we're excited to merge this work and continue to take steps towards a more full-featured shell. Soon to be coming will be Nu working on stable Rust(!!), some improvements in the Nu internal engine which will make it possible to have better streaming and cleaner commands, and features like aliases. diff --git a/blog/2019-11-23-nushell-survey-results.md b/blog/2019-11-23-nushell-survey-results.md new file mode 100644 index 00000000000..d2e615d414a --- /dev/null +++ b/blog/2019-11-23-nushell-survey-results.md @@ -0,0 +1,110 @@ +--- +title: Nushell 2019 Survey Results +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: Recently, we ran a short survey to see how you were feeling about nushell. Here are the results. +--- + +# Nushell 2019 Survey Results + +Recently, we ran a short survey to see how you were feeling about [Nushell](https://github.com/nushell/nushell). We wanted to give a very hearty "thank you!" to everyone who participated. These surveys are a great way to gather information about how people are feeling, where they're happy, and where they feel there are pain points. + +In total, **160** people responded. An impressive amount for a project still in its first few months in the public. + +# Do you use Nu? + +![63.1% don't use, 24.4% use but stopped, 12.5% use](../assets/images/nushell_survey_2019_percent.png) + +The survey welcomed both users and non-users of Nu. In our first question, we wanted to see how many folks are using Nu already. Perhaps unsurprising for a project still missing major functionality, most respondents aren't users, yet. As we'll see, there are themes around what people are waiting for before they jump in. + +But first, let's take a look at the responses from folks how are currently using Nu. + +# Nu users + +## What do you like? (20 responses) + +![favorite features (tables #1 by a long margin)](../assets/images/nushell_survey_2019_fave_features.png) + +Overwhelmingly, Nu users love tables! People currently using Nushell felt that tables and Nu's structured approach were their favorite features. + +People also enjoyed the rich support for different file formats that Nu ships with as well as its focus on being cross-platform. + +Other topics mentioned: syntax highlighting, good plugins, shells feature, tags feature, and that it is written in Rust. + +### Quotes +* _"The structured data handling is awesome!"_ +* _"Tables! \o/"_ +* _"It makes it easier to work with data on the command line. I especially love that it's cross-platform."_ + +## Where should Nushell improve? (20 responses) + +![needs work: top ones are autocomplete, shortcuts, tool integration](../assets/images/nushell_survey_2019_needs_work.png) + +Nu users also pointed out a few areas where they hoped Nu would improve over time. Top of mind were improvements around auto-completion, improving the keyboard shortcuts, and better integration with existing shells and tools. + +There were also a batch of additional improvements people wished for: full scripting support, better examples/documentation, improved stability, interactive table viewing, more commands, smarter table drawing, better coloring, better error messages, aliases, prompt customization, and general performance improvements. + +### Quotes +* _"Better documentation for how to write custom wrappers around existing tools."_ +* _"The coloring and autocomplete and a scripting language"_ +* _"Compatibility with other shells. It's annoying that I often have to add quotes when copying a command from a website."_ +* _"Honestly, I wish I knew enough about Nu that I could add a bunch of documentation to show others what it could do."_ + +# Nu non-users + +## What's stopping you from using Nu? (100 responses) + +![blocked adoption: top ones are time and maturity](../assets/images/nushell_survey_2019_blockers.png) + +We also asked for feedback from people not using Nu what their thoughts were. What are the kinds of things that block them from using Nu? + +Top of the list are "time" and "maturity". Many people mentioned that it takes time to learn a new system, and time is a precious resource (don't we know it!). Maturity also came up for a lot of folks - if it's not mature yet, the time investment might go to waste. In general, there was a sense of waiting until things are further along before jumping in. + +We also heard from many people who were perfectly comfortable in their current shells, whether it be zsh, bash, or fish. For these responders, Nu doesn't offer a compelling reason to switch, yet. + +### Quotes +* _"I'm very invested in bash already, but I love the concept and the work being done."_ +* _"Too comfy with the current shell, also I am lazy, but the project is awesome"_ +* _"I don’t transform data in the shell much, so the core value proposition of nu shell doesn’t resonate well with me."_ +* _"I know a lot about traditional shells and don't want to re-learn how to do all that in nushell"_ + +## Used Nu but stopped (38 responses) + +![made me stop: top ones are maturity, time, and don't need it](../assets/images/nushell_survey_2019_stoppers.png) + +For those folks who tried Nu, but decided it wasn't for them, we also gave them a chance to tell us why. Similarly to the previous question, "stability" and "time" were at the top of the list. + +Digging in a bit further, it's not only that Nu itself is changing, but that the package ecosystem hadn't stayed up-to-date with Nu's releases, or didn't yet offer a package. This meant it was easy to not be able to keep up, even if they had time to. + +Other topics that came up: needing better autocomplete, needing aliases, better scripting, support for Windows network drives, and improved documentation. + +### Quotes +* _"It was interesting, but I have a pretty significant ecosystem built around my flows in Bash and Zsh I can't give up just yet. Maybe that's just something I need to work with."_ +* _"Also the lack of documentation around the different commands is a major impediment."_ +* _"Lack of middle-of-the-word completion, mostly. Also all the aliases I have defined that I’d need to port over."_ + + +# Anything else we should know? (68 responses) + +![so much love](../assets/images/nushell_survey_2019_anything_else.png) + +As our final question, we gave responders a chance to give us any last thoughts they felt we should know. + +Overwhelming, people sent us love and encouragement. Lots of it. We wanted to take a moment to appreciate everyone who sent us kind notes to keep going, that they loved what we were building and were excited to try it in the future, and how much they loved the concept. Thank you! We're excited to keep going, and it feels great to hear from people who are enthusiastic about the project. + +### Quotes +* _"Keep going! Will definitely give Nu a try when it's more mature."_ +* _"I love how much effort is being put into communication and evolution of the tool."_ +* _"It is an interesting and worthwhile take on the command line environment."_ +* _"It's a great project, I wanna use it as my daily driver"_ +* _"I'm super super duper excited to use this shell"_ +* _"I think NuShell is an awesome project. Thanks for doing this"_ + +And thank *you* for responding to our survey! + +# Conclusions + +The astute reader may already see some of the changes we've done recently were directly inspired by comments in this survey, and more are planned. This has been a great help, and we're looking forward to growing Nu with you in the coming months. + +As always, feel free to come by our [discord](https://discord.gg/NtAbbGn), say hi on [twitter](https://twitter.com/nu_shell), or drop us a note in our [github](https://github.com/nushell/nushell). diff --git a/blog/2019-11-26-nushell-0_6_0.md b/blog/2019-11-26-nushell-0_6_0.md new file mode 100644 index 00000000000..4527afcf600 --- /dev/null +++ b/blog/2019-11-26-nushell-0_6_0.md @@ -0,0 +1,236 @@ +--- +title: Nushell 0.6.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: We're happy to announce the 0.6.0 release of Nu. This release has a bunch of new features, bugfixes, and general improvements. +--- + +# Nushell 0.6.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're happy to announce the 0.6.0 release of Nu. This release has a bunch of new features, bugfixes, and general improvements. + +# Where to get it + +Nu 0.6.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.6.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu` (or if you want all the features `cargo install nu --all-features`). + +# Starship support (Southclaws, jonathandturner) + +![Example of starship prompt](../assets/images/0_6_0_starship_prompt.png) +_Welcome to the starship!_ + +Having a configurable prompt has been a regularly requested feature, dating back to our first release of Nu. With 0.6.0, we're excited to show off the ability to integrate with [starship](https://starship.rs/). Starship is a powerful prompt being built in Rust, and it includes tons of fun features. + +To use the Starship support, enable the starship feature (the binary releases will have this on by default). After this, you'll want to [configure starship](https://starship.rs/config/) to meet your needs. + +Here's the config I use in the screenshot above: + +``` +❯ cat ~/.config/starship.toml +add_newline = false + +[git_branch] +symbol = "📙 " + +[git_status] +disabled = true +``` + +To enable Starship support, make sure to enable the `starship` feature, or to use the all-features build: + +``` +> cargo install nu --features starship-prompt +``` + +or + +``` +> cargo install nu --all-features +``` + +# Stable Rust (est31) + +Nu now works on stable Rust! + +Contributor est31 did a ton of work soon after our first Nu release, but it wasn't until just recently that it fully paid off. With the Rust 1.39 release, Nu now fully works on stable Rust! We're excited for what this means for package authors, as they will now have a stable dependency they can use to build Nu from, rather than tracking nightly. + +# New website! New blog! (sebastian-xyz) + +We're starting to work on an actual website, complete with a blog. In fact, where you're seeing this now is on our new site. We're excited to finally have something more official, and looking forward to growing the website in the weeks to come. + +If you're a web developer or designer and you want to help out, please join us! You can find us on the [website repo](https://github.com/nushell/nushell.github.io) and [blog repo](https://github.com/nushell/blog). + +# New features + +## histogram (andrasio) + +As we extend Nu's ability to function as a shell, we also wanted to include some features that help with doing some data analysis on structured data you're working with. In this release is a new `histogram` feature which gives a quick histogram of the data you're looking at: + +```shell +> open tests/fixtures/formats/caco3_plastics.csv | histogram origin +━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + # │ origin │ frequency +───┼──────────┼───────────────────────────────────────────────────────────────────────────────────────────────── + 0 │ COLOMBIA │ *********************************************************************************************** + │ │ ***** + 1 │ SPAIN │ ************************************************************ + 2 │ TURKEY │ ******************** +━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +``` + +## split-by (andrasio) + +When working with tables inside of tables, it's sometimes helpful to be able to group and regroup data so that the end result can be easily processed or charted. With this release, we've add a new command: `split-by`. Split-by is similar to `group-by`, in a way you can think of it as a re-group as it will create new groups to wrap your existing groups. + +To see how this works, let's say we have some shipping data, and we want to group these by the region: + +```shell +> open tests/fixtures/formats/caco3_plastics.csv | group-by origin + +━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━ + SPAIN │ COLOMBIA │ TURKEY +────────────────┼────────────────┼──────────────── + [table 3 rows] │ [table 5 rows] │ [table 1 rows] +━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━ +``` + +Next, let's say we know that inside of these new columns is a table that has a column called `shipped_at`. What we want to do is to `group-by` again, but this time use that new column to create new groups: + +```shell +/home/jonathan/Source/nushell(better_duration)> open tests/fixtures/formats/caco3_plastics.csv | group-by origin | split-by shipped_at +━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━ + 18/03/2016 │ 27/07/2016 │ 24/06/2016 │ 07/07/2016 │ 01/01/1900 │ 01/11/2016 │ 04/10/2016 +─────────────┼─────────────┼─────────────┼────────────────┼────────────────┼────────────────┼────────────── + [row SPAIN] │ [row SPAIN] │ [row SPAIN] │ [row COLOMBIA] │ [row COLOMBIA] │ [row COLOMBIA] │ [row TURKEY] +━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━ +``` + +What we have as a result is a kind of (row, column) grouping of the table data, which would allow you to graph for each date on one axis, and for each origin on the other. + +## default and compact (andrasio) + +One of the sticky issues working with tables is that sometimes you'll have gaps in the data. Perhaps there just isn't a value for that row. + +To help with that, we've added two new commands: `default` and `compact`. + +Default, as the name implies, will allow you to give blank spots a default value. Compact instead will allow you to remove a row if there's a blank in that position. + +Here's an example of default: + +```shell +> open amigos.json | get amigos +━━━┯━━━━━━━━━━━┯━━━━━━━━━━━━ + # │ name │ rusty_luck +───┼───────────┼──────────── + 0 │ Yehuda │ 1 + 1 │ Jonathan │ 1 + 2 │ Andres │ 1 + 3 │ GorbyPuff │ +━━━┷━━━━━━━━━━━┷━━━━━━━━━━━━ +``` + +We can default the missing column from the table like this: + +```shell +> open amigos.json | get amigos | default rusty_luck 1 giving: + +━━━┯━━━━━━━━━━┯━━━━━━━━━━━━ + # │ name │ rusty_luck +───┼──────────┼──────────── + 0 │ Yehuda │ 1 + 1 │ Jonathan │ 1 + 2 │ Andres │ 1 + 3 │ GorbyPuff│ 1 +━━━┷━━━━━━━━━━┷━━━━━━━━━━━━ +``` + +## format (jonathandturner) + +To add to the abilities of outputting tables of various into readable strings, we've recently added the `format` command. This allows you to convert table data into a string by following a formatting pattern: + +```shell +> ls | format "name is {name}" +━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + # │ +────┼──────────────────────────── + 0 │ name is .azure + 1 │ name is features.toml + 2 │ name is Cargo.toml + 3 │ name is LICENSE + 4 │ name is target + 5 │ name is images + 6 │ name is tests +``` + +## from-xlsx (jonathandturner) + +We now have an early start at Excel support. With it, you can now import Excel files as tables. + +# On-going improvements + +Lots of improvements to existing commands this time around. + +## Simple and full `ls` (jonathandturner) + +To make `ls` work better on smaller terminals (including the bog standard 80x24 login size), we've shrunk `ls` a tiny bit by default. Have no worry, though, the original columns and more are available in the new `ls --full`. + +## Fuzzy matching (bndbsh) + +```shell +❯ ls | where name =~ "yml" +━━━━━━━━━━━━━┯━━━━━━┯━━━━━━━┯━━━━━━━━━━━━┯━━━━━━━━━━━━ + name │ type │ size │ accessed │ modified +─────────────┼──────┼───────┼────────────┼──────────── + .gitpod.yml │ File │ 780 B │ a week ago │ a week ago +━━━━━━━━━━━━━┷━━━━━━┷━━━━━━━┷━━━━━━━━━━━━┷━━━━━━━━━━━━ +``` + +A long-requested feature is the ability to match strings a bit more fuzzily. With 0.6.0, you'll be able to do just that with the new `=~` (fuzzy match to include) and `!~` (fuzzy match to exclude) commands. + +## `from-csv`, now with separator (drmason13) + +Sometimes you might find a .csv file in the wild that uses a different separator than comma. You can now configure `from-csv` to use a different character as the separator using, for example, `from-csv --separator ";"`. + +## nth can take multiple row numbers (andrasio) + +You can now pass multiple row numbers to `nth`. For example `nth 1 3 5` will return those three separate rows as a new table. + +## Column paths can now include row numbers (wycats, andrasio) + +Sometimes when you're trying to get to data inside an inner table, you want to describe travelling through a particular row to get there. With recent improvements, you can now include the row number in the column path (assuming it is not the first part of the path). + +## Duration support (jonathandturner, Aloso) + +```shell +❯ ls | where accessed < 1w +━━━┯━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━━━━━┯━━━━━━━━━━━━━ + # │ name │ type │ size │ accessed │ modified +───┼───────────────┼───────────┼──────────┼─────────────┼───────────── + 0 │ Cargo.toml │ File │ 4.7 KB │ an hour ago │ an hour ago + 1 │ Makefile.toml │ File │ 449 B │ 2 days ago │ 2 days ago + 2 │ README.md │ File │ 19.5 KB │ an hour ago │ an hour ago + 3 │ Cargo.lock │ File │ 170.7 KB │ an hour ago │ an hour ago + 4 │ crates │ Directory │ 4.1 KB │ an hour ago │ an hour ago + 5 │ TODO.md │ File │ 1.3 KB │ an hour ago │ an hour ago +━━━┷━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━━━━━┷━━━━━━━━━━━━━ +``` + +It's now possible to use duration values in Nu. This allows us to check for files accessed less than a week ago, as you see in the example above. + +## Renamed `read` to `parse` (jonathandturner) + +To help with at-a-glance readability, we've renamed `read` to `parse`. While `read` felt more friendly, it could easily be confused for reading input, reading a file, etc. + +# General improvements (wycats, thegedge, drmason13, jonathandturner, uma1317, JesterOrNot, andrasio, BurNiinTRee) + +There has been a ton of work behind the scenes on Nu itself. We now have a much-improved internal debugging system and better module separation courtesy of wycats. There are also a number of general cleanups and bugfixes that have gone into the release. + +# Survey results + +We recently ran a survey to ask Nu users/non-users what they thought of Nu. If you're interested, definitely check out the [results of the survey](https://www.nushell.sh/blog/2019/11/23/nushell-survey-results.html) + +# Looking ahead + +We're still hard at work on "MVP #2". It will be the next milestone on our way to the eventual 1.0. If you'd like to help with code, docs, translation, testing, or just want to come chat and throw ideas around, we'd love to have you! You can find us on [discord](), [twitter](https://twitter.com/nu_shell), and [github](https://github.com/nushell/nushell). diff --git a/blog/2019-12-18-nushell-0_7_0.md b/blog/2019-12-18-nushell-0_7_0.md new file mode 100644 index 00000000000..1da731928f7 --- /dev/null +++ b/blog/2019-12-18-nushell-0_7_0.md @@ -0,0 +1,155 @@ +--- +title: Nushell 0.7.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: We're happy to announce the 0.7.0 release of Nu. This release has a couple new features, bugfixes, and lots of internal improvements on the way to upcoming features. +--- + +# Nushell 0.7.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're happy to announce the 0.7.0 release of Nu. This release has a couple new features, bugfixes, and lots of internal improvements on the way to upcoming features. + +# Where to get it + +Nu 0.7.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.7.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu` (or if you want all stable features `cargo install nu --features=stable`). + +# Ranges (wycats, sebastian-xyz) + +We've added ranges as new fundamental type in Nu. To use it, use `..`. Currently, you can use it with the new `range` command, which lets you do commands like: + +``` +ls | range 3..5 +``` + +And return rows 3 through 5 of the table that `ls` gives you. + +# Autocomplete improvements (jonathandturner) + +As we improve the parser, we are getting more opportunities to do more with the results. One feature we added recently is the ability to autocomplete flags for internal commands. + +For example, if you want to see what's available for the `config` command, you can now type `config --` and then immediately use the `` key to cycle through possible options. + +# Nu becomes multiple crates (wycats, jonathandturner) + +Part of a big effort to get Nu ready for script support is to refactor the current codebase to make it cleaner and easier to work with. + +For the last few weeks, a big part of this refactor involved splitting our growing monolith of a codebase into separate sub-crates that work together to give the same functionality. As we've done so, we've been able to clean up some of the interfaces between the code. The end result is something that already is easier to work with, and we're excited about what this means for future development. + +One side effect of this work is that we've now separated out the plugins from the main `nu` crate. This gives you more options to configure your Nu setup how you want, as each optional crate can be separately installed. + +From cargo, you can install the main crate with: + +``` +cargo install nu +``` + +Then, you can install the plugins the same way. You can find them because they have a name starting with `nu_plugin_`. For example, to install the textview plugin: + +``` +cargo install nu_plugin_textview +``` + +The current set of plugins includes: +* nu_plugin_average +* nu_plugin_binaryview +* nu_plugin_fetch +* nu_plugin_inc +* nu_plugin_match +* nu_plugin_post +* nu_plugin_ps +* nu_plugin_str +* nu_plugin_sum +* nu_plugin_sys +* nu_plugin_textview +* nu_plugin_tree + +By default, Nu will install a small set of these plugins ("sys", "ps", "textview", "inc", "str"). You can optionally turn this off using: + +``` +cargo install nu --no-default-features +``` + +# Introducing: stable and unstable features + +Another part of the current refactor work is that we're splitting the "stable" and "unstable" features up. This lets us experiment a bit easier before a command becomes a stable part of the releases. + +Now, to install all the stable features, you can use: + +``` +cargo install nu --features=stable +``` + +If you want to get both stable *and* unstable features, use: + +``` +cargo install nu --all-features +``` + +Warning: unless you're working on Nu itself you may not want to install all features currently, as you'll see that we're working on an internal tracing tool. + +# Moving the book(s) (sebastian-xyz) + +We've been hard at working building up the websites. In the previous release, we talked about "nushell.sh" and the new website there. Since then, we've consolidated the books into the new website. Please update your book links to point to the new site: + +* Nu book - [nushell.sh/book](https://www.nushell.sh/book/) +* Contributor book - [nushell.sh/contributor-book](https://www.nushell.sh/contributor-book/) +* Cookbook (in-progress) - [nushell.sh/cookbook](https://www.nushell.sh/cookbook/) + +# Command improvements + +## Embed -> Wrap (jonathandturner, andrasio) + +For better readability, we've renamed the `embed` command to `wrap`. As the name implies, you can now `wrap` one table with another. You can also use `wrap` to create a table from a stream of values. + +For example, you may have a list of strings you want to turn into a table: + +``` +> ls | get name +────┬──────────────────── + # │ +────┼──────────────────── + 0 │ target + 1 │ CODE_OF_CONDUCT.md + 2 │ .cargo + 3 │ src + 4 │ features.toml + 5 │ TODO.md +``` + +We can now name this table using `wrap`: + +``` +> ls | get name | wrap filename +────┬──────────────────── + # │ filename +────┼──────────────────── + 0 │ target + 1 │ CODE_OF_CONDUCT.md + 2 │ .cargo + 3 │ src + 4 │ features.toml + 5 │ TODO.md +``` + +# Internal improvements (wycats, jonathandturner, thibran, thegedge) + +Though not visible as additional new features, a group of us has been at work refactoring and cleaning up Nu's internals. This should help us both fix some long-standing bugs as well as make way for new features in the future. + +We've also internally introduced a new "line" type, which represents strings that carry a line ending with them. This helps us more easily traffic string data through the system and know how best to output it at the end of the pipeline. + +# Bugfixes + +Of course, with each release, there are the usual bugfixes. We've improved tilde expansion (naufraghi), how internal pipelines are handled (thegedge), and more. + +# Improved docs (tchak, coolshaurya, sebastian-xyz) + +A big "thank you!" for folks continuing to work on the on-going command documentation efforts. Already, we're seeing people [read about the commands](https://www.nushell.sh/documentation.html) on the new website to help them learn Nu, which is great! + +# What's next? + +You might have noticed that with 0.7.0, we're seemingly getting close to 1.0. What happens after 0.9.0? Are we going to take the leap? + +In short, not just yet. After 0.9.0, we'll release 0.10.0. Nu is maturing, but it isn't quite ready for the big One-Point-Oh. We'll continue maturing it until it's ready to make the move. diff --git a/blog/2019-12-31-happy-nu-year-2020.md b/blog/2019-12-31-happy-nu-year-2020.md new file mode 100644 index 00000000000..a6682618fe6 --- /dev/null +++ b/blog/2019-12-31-happy-nu-year-2020.md @@ -0,0 +1,184 @@ +--- +title: Happy Nu Year 2020 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: 2019 was quite the year for Nushell. We landed the initial commit on May 10th, and 1881 commits later we find ourselves at the end of 2019. What all happened this year? +--- + +# Happy Nu Year 2020 + +![Happy Nu Year!](../assets/images/happy_nu_year_2020.png) + +2019 was quite the year for Nushell. We landed the initial commit on May 10th, and 1881 commits later we find ourselves at the end of 2019. What all happened this year? + +We started off with quite the bang! After quietly working on Nu for a few months, we wrote up a [blog post](https://www.nushell.sh/blog/2019/08/23/introducing-nushell.html) to explain what Nu was. To our surprise, the post got a surprisingly warm reception! Soon, we were recording a podcast with the Changelog to [talk about Nu](https://changelog.com/podcast/363). + +As the excitement calmed back to everyday levels, we got to the work of turning this minimum-viable product into the real thing. More than 65 people joined us to help fix bugs, test code, write docs, and explore new directions. + +## Where are we? + +At the end of 2019, where are we? + +- We now have a [website](https://nushell.sh), a [blog](https://www.nushell.sh/blog), [three](https://www.nushell.sh/book/) [different](https://www.nushell.sh/contributor-book/) [books](https://www.nushell.sh/cookbook/), and the results of our [first survey](https://www.nushell.sh/blog/2019/11/23/nushell-survey-results.html) +- We released 6 different releases: [0.2](https://www.nushell.sh/blog/2019/08/23/introducing-nushell.html), [0.3](https://www.nushell.sh/blog/2019/09/24/nushell_0_3_0.html), [0.4](https://www.nushell.sh/blog/2019/10/15/nushell-0_4_0.html), [0.5](https://www.nushell.sh/blog/2019/11/05/nushell-0_5_0.html), [0.6](https://www.nushell.sh/blog/2019/11/26/nushell-0_6_0.html), and [0.7](https://www.nushell.sh/blog/2019/12/18/nushell-0_7_0.html). +- Nu gained features. Lots of them. New table designs, new file formats, lots of new commands, improvements to error reporting, plugins (in [C++](https://github.com/lefticus/nu_plugin_calc), [Go](https://vsoch.github.io/2019/nushell-plugin-golang/), [Python](https://github.com/vsoch/nushell-plugin-python), and [Ruby](https://github.com/andrasio/nu-plugin/tree/master/examples)), new colors, support for streaming tables, vi mode, moved to the stable Rust compiler, login shell support, recycle bin support, starship.rs support, fuzzy matching, duration and date comparison, ranges, improved autocomplete, and a bunch of internal improvements to make way for 2020. +- Thanks to all the reports, PRs, and help debugging we've made a ton of progress in making Nu more stable and complete + +## What's ahead? + +That said, it's "[def early days](https://twitter.com/yoshuawuyts/status/1210367651354161152?s=20)" for Nu, as one recent user put it. We couldn't agree more. It's not *quite* ready for people to use as their everyday shell. Things we're working on in 2020 to make it possible for everyone to use Nu in their day-to-day work: + +- Stability fixes! We'll be working hard to make Nu rock solid. +- Aliases, variables, functions, scripts +- Better integration with the native OS +- Improved line editing +- A better motto (lots of people confused about what "Github-era" means) + +In short, it's been a lot of fun, a lot of work, and we met some new friends along the way. A very big "thanks!" to all our contributors this year! + +## Nushell repo +```shell +> fetch https://api.github.com/repos/nushell/nushell/stats/contributors | get author | sort-by login | get login +────┬─────────────────── + # │ +────┼─────────────────── + 0 │ Aloso + 1 │ BatmanAoD + 2 │ BradyBromley + 3 │ BurNiinTRee + 4 │ Detegr + 5 │ DrSensor + 6 │ Flare576 + 7 │ GuillaumeGomez + 8 │ JesterOrNot + 9 │ JonnyWalker81 + 10 │ Paradiesstaub + 11 │ Porges + 12 │ Southclaws + 13 │ aidanharris + 14 │ andrasio + 15 │ bndbsh + 16 │ chhetripradeep + 17 │ coolshaurya + 18 │ cristicismas + 19 │ davidrobertmason + 20 │ devnought + 21 │ djc + 22 │ drmason13 + 23 │ eoinkelly + 24 │ est31 + 25 │ gilesv + 26 │ iamcodemaker + 27 │ incrop + 28 │ ineol + 29 │ jankoprowski + 30 │ jdvr + 31 │ jerodsanto + 32 │ jonathandturner + 33 │ landaire + 34 │ lesichkovm + 35 │ marcelocg + 36 │ max-sixty + 37 │ mfarberbrodsky + 38 │ miller-time + 39 │ mlbright + 40 │ nalshihabi + 41 │ naufraghi + 42 │ notryanb + 43 │ oknozor + 44 │ orf + 45 │ oskarskog + 46 │ piotrek-szczygiel + 47 │ pizzafox + 48 │ pka + 49 │ pmeredit +────┴─────────────────── +────┬─────────────── + # │ +────┼─────────────── + 50 │ quebin31 + 51 │ ramonsnir + 52 │ rnxpyke + 53 │ rtlechow + 54 │ sdfnz + 55 │ sebastian-xyz + 56 │ svartalf + 57 │ t-hart + 58 │ taiki-e + 59 │ tchak + 60 │ thegedge + 61 │ tim77 + 62 │ twe4ked + 63 │ uma0317 + 64 │ vsoch + 65 │ vthriller + 66 │ wycats + 67 │ yaahc + 68 │ yahsinhuangtw +────┴─────────────── +``` + +## Nushell book repo +```shell +> fetch https://api.github.com/repos/nushell/book/stats/contributors | get author | sort-by login | get login +────┬───────────────── + # │ +────┼───────────────── + 0 │ Andrew-Webb + 1 │ andrasio + 2 │ boisgera + 3 │ jankoprowski + 4 │ jonathandturner + 5 │ landaire + 6 │ lord + 7 │ marcelocg + 8 │ mistydemeo + 9 │ mlh758 + 10 │ pizzafox + 11 │ pka + 12 │ romanlevin + 13 │ rtlechow + 14 │ sebastian-xyz + 15 │ ymgyt +────┴───────────────── +``` + +## Contributor book +```shell +> fetch https://api.github.com/repos/nushell/contributor-book/stats/contributors | get author | sort-by login | get login +───┬───────────────── + # │ +───┼───────────────── + 0 │ andrasio + 1 │ daveremy + 2 │ jankoprowski + 3 │ jonathandturner + 4 │ sebastian-xyz +───┴───────────────── +``` + +## Cookbook +```shell +> fetch https://api.github.com/repos/nushell/cookbook/stats/contributors | get author | sort-by login | get login +───┬───────────────── + # │ +───┼───────────────── + 0 │ jonathandturner + 1 │ notryanb + 2 │ sebastian-xyz +───┴───────────────── +``` + +## Blog +```shell +> fetch https://api.github.com/repos/nushell/blog/stats/contributors | get author | sort-by login | get login +───┬───────────────── + # │ +───┼───────────────── + 0 │ Aloso + 1 │ jonathandturner + 2 │ sebastian-xyz + 3 │ waldyrious +───┴───────────────── +``` diff --git a/blog/2020-01-07-nushell-0_8_0.md b/blog/2020-01-07-nushell-0_8_0.md new file mode 100644 index 00000000000..ef1ea52ceee --- /dev/null +++ b/blog/2020-01-07-nushell-0_8_0.md @@ -0,0 +1,132 @@ +--- +title: Nushell 0.8.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: We're happy to announce the 0.8.0 release of Nu. This continues a series of internal improvements, with better stability and correctness, and, of course, new features. +--- + +# Nushell 0.8.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're happy to announce the 0.8.0 release of Nu. This continues a series of internal improvements, with better stability and correctness, and, of course, new features. + +# Where to get it + +Nu 0.8.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.8.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +``` +❯ ls nu_plugin_* | sort-by name | get name +────┬────────────────────── + # │ +────┼────────────────────── + 0 │ nu_plugin_average + 1 │ nu_plugin_binaryview + 2 │ nu_plugin_fetch + 3 │ nu_plugin_inc + 4 │ nu_plugin_match + 5 │ nu_plugin_post + 6 │ nu_plugin_ps + 7 │ nu_plugin_str + 8 │ nu_plugin_sum + 9 │ nu_plugin_sys + 10 │ nu_plugin_textview + 11 │ nu_plugin_tree +────┴────────────────────── +``` + +# Unwrapping your presents (jonathandturner, andrasio, with help from ubsan) + +A classic trick when writing Rust is to use the `.unwrap()` method. This method gives you a quick way to say "panic if you see this happen". When prototyping, it's easy to use this as a way to develop code more quickly, but as a codebase matures you move away from it. + +It was time for Nu to move away from using this shortcut. Fixing the unwraps is a lot of work, but the end result is a codebase that reports errors more reliably and doesn't panic as often if something unexpected happens -- which just is what you want when you're making a shell! + +We're happy to say there are now no more unwraps in the Nu codebase. We have more improvements in mind, but this already is a big upgrade from where we were a few weeks ago. + +# Clippy cleanliness (thibran, vorot93, jonathandturner) + +Along the same theme of making code as clean as we can, we recently adopted using the `clippy` tool. Clippy is a tool to help point out common mistakes or inefficiencies in your Rust code. The end result of working through its warnings is often a cleaner looking codebase that's also a bit more efficient as a result. + +The Nu codebase is now clippy-clean, and we're enforcing this on every new checkin to the codebase. + +# Improved +## `which` gets better (avandesa) + +```shell +> which which +───────┬──────────────────────────┬───────── + arg │ path │ builtin +───────┼──────────────────────────┼───────── + which │ nushell built-in command │ Yes +───────┴──────────────────────────┴───────── +``` + +We're in the process of improving some of our existing built-in commands to make them more Nu-like. In this release, the `which` command has a bit more of a Nu-feel. It will tell you the path and if the command is an internal builtin command or an external command. + +## `ps` gets better (jonathandturner) + +``` +─────┬───────┬──────────────────────────────────────┬──────────┬─────────┬──────────┬────────── + # │ pid │ name │ status │ cpu │ mem │ virtual +─────┼───────┼──────────────────────────────────────┼──────────┼─────────┼──────────┼────────── + 250 │ 4729 │ ibus-engine-simple │ Sleeping │ 0.0000 │ 3.3 MB │ 176.7 MB + 251 │ 5964 │ gedit │ Sleeping │ 0.0000 │ 29.2 MB │ 496.5 MB + 252 │ 5860 │ seahorse │ Sleeping │ 0.0000 │ 24.0 MB │ 488.7 MB + 253 │ 6594 │ gnome-terminal-server │ Sleeping │ 0.0000 │ 47.8 MB │ 675.0 MB +``` + +The `ps` command has gained a few new columns: "mem" and "virtual" for helping you track memory usage. + +## OpenOffice .ods support (coolshaurya) + +Fresh off the presses is initial support for opening .ods files. Similarly to our xlsx support, this will allow you to open .ods files and read in their data, separated by the sheets. + +## Improved keyboard navigation (Aloso) + +We now support moving left by-word using the ctrl+left and ctrl+right keyboard shortcuts. + +# New commands + +## uniq (notryanb) + +With 0.8.0, you'll also be able to remove duplicate rows from your tables with the `uniq` command: + +``` +> open test.csv +───┬────────────┬───────────┬────────────┬────── + # │ first_name │ last_name │ rusty_at │ type +───┼────────────┼───────────┼────────────┼────── + 0 │ Andrés │ Robalino │ 10/11/2013 │ A + 1 │ Andrés │ Robalino │ 10/11/2013 │ A + 2 │ Jonathan │ Turner │ 10/12/2013 │ B + 3 │ Yehuda │ Katz │ 10/11/2013 │ A +───┴────────────┴───────────┴────────────┴────── +``` + +``` +> open test.csv | uniq +───┬────────────┬───────────┬────────────┬────── + # │ first_name │ last_name │ rusty_at │ type +───┼────────────┼───────────┼────────────┼────── + 0 │ Andrés │ Robalino │ 10/11/2013 │ A + 1 │ Jonathan │ Turner │ 10/12/2013 │ B + 2 │ Yehuda │ Katz │ 10/11/2013 │ A +───┴────────────┴───────────┴────────────┴────── +``` + +# New built-in variable (jonathandturner) + +With 0.8.0, we've moved away from the `$nu:path` built-ins. Now, there's just one built-in for internal values: `$nu`. Using `echo $nu` will show you the table of current values. + +# Fixing bugs (jonathandturner, sandorex, miller-time, quebin31, thegedge) + +As always, we also fixed bugs. In 0.8.0, you'll see improvements with UTF-8, the `pick` command, correctly handling required positional arguments, CTRL+L clear screen, and faster response times for external commands. + +# What's coming + +We're well on our way to 0.10.0. That's right, we're not close to our 1.0 release just yet. After 0.9, we'll continue with a release every three weeks. Expect to see Nu continue to mature and stabilize. diff --git a/blog/2020-01-28-nushell-0_9_0.md b/blog/2020-01-28-nushell-0_9_0.md new file mode 100644 index 00000000000..5bda79f86e5 --- /dev/null +++ b/blog/2020-01-28-nushell-0_9_0.md @@ -0,0 +1,148 @@ +--- +title: Nushell 0.9.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: We're happy to announce the 0.9.0 release of Nu. This release offers better help and error feedback, better support for the native shell, new commands, lots of command improvements, and bugfixes. +--- + +# Nushell 0.9.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're happy to announce the 0.9.0 release of Nu. This release offers better help and error feedback, better support for the native shell, new commands, lots of command improvements, and bugfixes. + +# Where to get it + +Nu 0.9.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.9.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's new + +## `--help` available on all commands (Amanita-muscaria) + +One of the first things a user might do in a new shell is to type a familiar command and pass it `--help`. A perfectly reasonable thing to do, and with 0.9.0 it does exactly you'd expect. It will now print out the help information for the given command for all internal commands (much in the same way as using `help `) + +## Better error feedback (wycats, andrasio) + +![Better inline errors!](../assets/images/0_9_0_error_highlight.png) + +Our improvements to the parser as part of 0.9.0 also come with some fun perks. One of these is that unknown flags, and similar errors, will now get highlighted red to let you know that this isn't a valid input to the command. + +## Shelling out (jonathandturner) + +An early feature of Nu that people that has been a popular request to bring back is "shelling out". When Nu doesn't recognize a command, it will try to find it as an external command. In the last few versions, this was limited as Nu was not able to execute shell scripts, .cmd scripts... basically anything that wasn't an executable. The problem is that lots of apps use scripts as a way to configure what to execute (commands like `code`, `npm`, and others are common scripts behind the scenes). + +With 0.9.0, we're returning to our earlier behavior and executing both binaries and shell scripts by calling to the platform-native shell when we call an external command. While this should largely be invisible as a user, more things should "just work" how they would in bash or Windows Terminal. + +## New commands + +### du (Amanita-muscaria) + +Nu now has its own `du` command to show the disk usage of a part of the file system. This is a handy way of quickly looking for where all your free space went. + +``` +❯ du +───┬───────────────┬─────────┬──────────────── + # │ name │ size │ contents +───┼───────────────┼─────────┼──────────────── + 0 │ .git │ 4.7 MB │ [table 6 rows] + 1 │ .jekyll-cache │ 49.0 KB │ [table 1 rows] + 2 │ _includes │ 881 B │ + 3 │ _layouts │ 4.3 KB │ + 4 │ _posts │ 82.4 KB │ + 5 │ _sass │ 21.5 KB │ + 6 │ _site │ 5.3 MB │ [table 4 rows] + 7 │ assets │ 2.4 MB │ [table 1 rows] + 8 │ images │ 2.4 MB │ +───┴───────────────┴─────────┴──────────────── +``` + +### clear (JesterOrNot) + +Short, sweet, and to the point, you can now `clear` your screen with the new `clear` command. Like our other commands, this works across all the platforms Nu runs on. + +## New welcome message (jonathandturner) + +``` +Welcome to Nushell 0.9.0 (type 'help' for more info) +nushell on 📙 bump_to_0_9_0 is 📦 v0.9.0 via 🦀 v1.40.0 +❯ +``` + +The first time you open Nu now you'll be greeted by a brief message to tell you the version of Nu and a reminder to use the `help` command to learn more about Nu and how it works. + +## Improved table streaming (jonathandturner) + +If you've used earlier versions of Nu, you may have wondered why every 50 rows we start a new table. This is where the implementation showed through a bit more than it should. As tables are printed, they are created and then displayed as enough rows are available. This means that output will spool to the screen and not wait for the table to finish processing before you see something. In general, it's good to see the tables earlier, but seeing a different shape of table every 50 rows can be annoying. + +We've updated table output to be a lot cleaner, using this logic: + +* If rows are being output quickly, build a larger table before outputting it +* If rows are being output slowly, buffer a smaller number of rows and display them (just as before) +* If rows change shape, switch to showing a different table. This helps you visually see when your data source is giving you a new kind of data + +## Command improvements + +### `ls` and `rm` now error when a path isn't found (Amanita-muscaria) + +Adding a bit of polish this release, `ls` and `rm` will now error if you pass them a path they can't find. + +### `ls` can optionally show just the filename (coolshaurya) + +If you've used `ls` on your subdirectories, you might have noticed that the subdirectory becomes part of the filename. This can be great for building up a pipeline (and a script in the future), but sometimes all you care about is the filename. You can now pass `ls` the `--short-names` command flag to get just the filename. + +### `ls` can also optionally show symlink targets (JosephTLyons) + +Further improving `ls`, you can now see the symlink targets with the `--full` flag. + +### `ls` smaller by default, now with more info with `--full` (jonathandturner) + +To make Nu easier to use on smaller terminals, the `ls` command will now try to take up less space by default. The columns from earlier version of Nu (and a few more!) are still available, now behind the `--full` flag. + +### `from-xml` now includes attributes (Borimino) + +One of the first commands we built to import file data into Nu was `from-xml`. It was good enough to get started, and with 0.9.0 it improves to being a more precise representation of what's in the XML file. The command will now include attribute values as part of the table. + +### `sort-by` works with more value types (koenaad) + +Our sorting command `sort-by` can now work over more value types, which simplifies some common sorting tasks. + +### `debug` now pretty-prints its output (sandorex) + +When working on Nu itself, there's a handy `debug` command which gives you all the information about the value coming through the pipeline. This is now prett-printed by default to make it easier to read. + +### autocompletion can now be configured (Jacobious52) + +Autocompletion at the Nu prompt can now be changed between circular (the default) and list. + +``` +> config --set [completion_mode list] +``` + +### More improvements to `which` (avandesa) + +The structured `which` continues to improve 0.9.0 and will now give an error in cases that it could not be performed correctly. + +### Improvements to calling external commands (thegedge, andrasio, koenaad) + +A batch of improvements should allow external commands to feel a bit faster and work more consistently with the pipeline. + +## Documentation + +### More command docs (coolshaurya) + +We're continuing to document the commands that are available and continue filling out command documentation where it's missing. + +### More READMEs and code documentation (notryanb, jonathandturner) + +Contributors to Nu will also appreciate that we're working our way through the code and source repositories and documenting how each part works. This should help developers get used to Nu from the inside and find a much easier path to jump in. + +# Looking ahead + +With 0.9.0, we've added a lot of "quality of life" improvements that we hope you enjoy. We'd love to hear from you how 0.9.0 works for you. + +Next release will be 0.10.0, as we continue to improve Nu. We're excited about what's coming, and can't wait to play with it ourselves! diff --git a/blog/2020-02-18-nushell-0_10_0.md b/blog/2020-02-18-nushell-0_10_0.md new file mode 100644 index 00000000000..3f0e96dd7e0 --- /dev/null +++ b/blog/2020-02-18-nushell-0_10_0.md @@ -0,0 +1,130 @@ +--- +title: Nushell 0.10.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: Greetings and welcome to the 10th release of Nushell! Yes, that's right this is the tenth release of Nu we've put out in the wild, and oh is this release wild. So let's stop dilly-dallying and get right to it, shall we? +--- + +# Nushell 0.10.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Greetings and welcome to the 10th release of Nushell! Yes, that's right this is the tenth release of Nu we've put out in the wild, and oh is this release wild. So let's stop dilly-dallying and get right to it, shall we? + +# Where to get it + +Nu 0.10.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.10.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's new + +## Scripts! (thegedge, jonathandturner) + +Yes, you read that right, we're just beginning to add support for running Nu scripts. So far, these scripts are simple things. Nu will go line by line and run each line. But we're looking forward to building up support with more features as we go. + +To run a script, you just call `nu` and pass in it the script file: + +```sh +> cat hello_world.nu +echo hello +echo world + +> nu hello_world.nu +hello +world +``` + +## Running commands from outside Nu (jonathandturner) + +Another fun features in this release is the ability to run a Nu command from outside of Nu. Just like shells like Bash and Windows CMD, you can now pass the `-c` flag and give the pipeline you want to run: + +```sh +> ./nu -c "ls | get name" +─────┬─────────────────────────────── + # │ +─────┼─────────────────────────────── + 0 │ .cargo-lock + 1 │ .fingerprint + 2 │ build + 3 │ deps +``` + +## Shorthand flags (Amanita-muscaria) + +Tired of typing those long flags that every Nu command seems to have? Worry no more! You can now use short flags in many common Nu commands. For example: + +Instead of: +```sh +> ls --full +``` + +You can now use: +```sh +> ls -f +``` + +The shorthand flags are listed as part of the updated help section + +## Did someone say flags? (andrasio) + +If you're coming to Nu from other CLIs, you might have wondered why you always had to put flags at the end. A little annoying, right? We fixed it. + +```sh +> ls *.sh --full +``` + +and now: +``` +> ls --full *.sh +``` + +Use whichever you like best. + +## More plugins by default (andrasio) + +We've extended the set of plugins installed with `cargo install nu --features=stable` to the whole set of stable plugins. This cuts down on the amount of extra plugins to install if you want the full set. It should also help cut down on the confusion when users expected a command to be available but wasn't installed by default. You can still install without these additional commands, if you like, and pick and choose the ones you want. + +## `calc` command (coolshaurya) + +There's a new `calc` command in development that can calculate the result of math expressions in a string. + +```sh +> echo "2+3" | calc +5.000000000000000 +``` + +## `kill` command (sandorex) + +Nu now also has a cross-platform `kill` command, for killing processes. + +## Command improvements + +### External commands can access `$nu` (andrasio) + +External commands commands can now access the `$nu` variable that holds internal values for Nu. + +### Datetime parsing (Amanita-muscaria) + +You can now parse datetime strings using the `str` command. + +### `du` command now shows apparent and physical disk usage (Amanita-muscaria) + +The `du` command now lets you see both the amount of space that directories appear to take as well as the amount of total actual space they take up on the disk. + +### Better `help` message (jonathandturner) + +By default, the `help` command now prints a little more information by default to help you get started. + +## Lots of bugfixes/improvements (thegedge, UltraWelfare, jonathandturner, andrasio, avandesa, notryanb, coolshaurya, twitu) + +Better errors for incorrect `mv` and incorrect flags, better performance running external commands, better code documentation, plugins can now have numbers in their names, test directories can now have spaces in their names, fixed some issues with `cp`, moved off of the "futures-preview" crate to "futures" official, fixes to working with external commands that don't send line endings, improvements to `textview` and more. + +# Looking ahead + +Adding the ability to run scripts gives Nu a lot more potential when used in larger tasks, and we're excited to continue to grow this support. This work comes out of the work to add aliases, which we're currently working on. It also opens up the possibility of running Nu from other hosts in the future. + +Scripting also lends itself to needing more structure, variables, and more. We're looking ahead to those, too. diff --git a/blog/2020-03-10-nushell_0_11_0.md b/blog/2020-03-10-nushell_0_11_0.md new file mode 100644 index 00000000000..c9a05ace861 --- /dev/null +++ b/blog/2020-03-10-nushell_0_11_0.md @@ -0,0 +1,110 @@ +--- +title: Nushell 0.11.0 +author: Jonathan Turner +author_site: https://twitter.com/jntrnr +author_image: https://www.nushell.sh/blog/images/jonathandturner.jpg +excerpt: We're excited to release the 0.11.0 release of Nu. This release continues to push us forward with new commands, improved engine internals, bugfixes, and more. +--- + +# Nushell 0.11.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're excited to release the 0.11.0 release of Nu. This release continues to push us forward with new commands, improved engine internals, bugfixes, and more. + +# Where to get it + +Nu 0.11.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.11.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's new + +## Compound shorthand flags (Amanita-muscaria) + +Over the last few releases, we've seen the ability for flags to have shorthand version. You no longer needed to use `--full` if the flag supported the shorter `-f` version. + +In this release, we've taken it one step further and allowed you to combine multiple shorthand flags into one group. For example, `ls --full --short-names` can now be written as `ls -fs` + +## Improvements and cleanup for `ls` (Bocom, quebin31, lincis, equal-l2) + +A lot of improvements went into `ls` for this release. The updated `ls` command is now more forgiving of coming across directories the user can't access and will simply show what it can and continue, it can work with named pipes on systems with them, it shows a more reasonable display for zero-length files, and the internals of `ls` have been cleaned a bit to make way for future improvements. + +## External command output no longer blocks (thegedge) + +Continuing our series of improvements to working with external commands, we have a few updates in this release. The first of these updates is an improvement to how content streams out of externals. With 0.11.0, this content will no longer block, which allows content to flow more easily between external and internal commands. As a result, some corner cases that came up with a series of commands in a pipeline not working because one blocks no longer is an issue. + +## Allow externals to output texts or binary (jonathandturner, thegedge) + +The second update to externals now allows externals to freely output either text or strings, and for this content to be read in a block at a time into Nu. This allows externals to stream any content they wish, and for this stream to continue for as long as needed. + +## New `shuffle` command (hirschenberger) + +With 0.11.0, we introduce a new `shuffle` command that will let you shuffle the rows of a table. This allows you to choose to not always process data the same way, or to search through data more stochastically. + +``` +❯ help commands | shuffle +─────┬──────────────┬─────────────────────────────────────────────────────────────────────────────────────────────── + # │ name │ description +─────┼──────────────┼─────────────────────────────────────────────────────────────────────────────────────────────── + 0 │ textview │ Autoview of text data. + 1 │ pwd │ Output the current working directory. + 2 │ sort-by │ Sort by the given columns. + 3 │ tree │ View the contents of the pipeline as a tree. + 4 │ du │ Find disk usage sizes of specified items + 5 │ table │ View the contents of the pipeline as a table. +``` + +## New column `rename` command (andrasio) + +You can also now use the new `rename` command to rename a column to a new name. + +``` +❯ help commands | rename action description +─────┬──────────────┬─────────────────────────────────────────────────────────────────────────────────────────────── + # │ action │ description +─────┼──────────────┼─────────────────────────────────────────────────────────────────────────────────────────────── + 0 │ append │ Append the given row to the table + 1 │ autoview │ View the contents of the pipeline as a table or list. + 2 │ average │ Compute the average of a column of numerical values. + 3 │ binaryview │ Autoview of binary data. +``` + +## Merge the `env` command into the `$nu` variable (jonathandturner) + +The `$nu` variable has grown to include values that were previously part of `env`, effectively merging the two into the `$nu` variable. This allows you to easily find out where the history file is stored, where config is stored, and where a good temp directory are all in one place: + +``` +❯ echo $nu.home-dir $nu.temp-dir $nu.config-path $nu.history-path +───┬────────────────────────────────────────────────────────────────────── + # │ +───┼────────────────────────────────────────────────────────────────────── + 0 │ C:\Users\joturner + 1 │ C:\Users\joturner\AppData\Local\Temp\ + 2 │ C:\Users\joturner\AppData\Roaming\nu shell developers\nu\config.toml + 3 │ C:\Users\joturner\AppData\Local\nu shell developers\nu\history.txt +───┴────────────────────────────────────────────────────────────────────── +``` + +## The `format` command can now use column paths (andrasio) + +The `format` command is a handy way of putting column data into a string for displaying, but it previously had the restriction that you couldn't use it to print out information that was deeper in the table. With 0.11.0, we've removed that restriction. + +``` +❯ open Cargo.toml | format "The edition is {package.edition}" +The edition is 2018 +``` + +## Allow help to be printed with `-h` in more cases (rabisg0) + +You should now be able to use `-h` to reach the help of a command in more cases than was previously allowed, making it a universal way to get to the help text. + +## Improved documentation (coolshaurya, Amanita-muscaria, notryanb) + +Documentation for `du`, `uniq`, `debug`, and plugin docs have all been improved in this release. + +# Looking ahead + +We're excited to continue to polish how Nu works to make it more reliable and more efficient. Of course, we're also working on adding new much-requested features like aliases in upcoming releases. If you'd like to help with aliases or with Nu in general -- even if you want to help with a part of the project outside of just coding -- we'd love to have you. Come visit us on [github](https://github.com/nushell/nushell) or the [discord](https://discord.gg/NtAbbGn). diff --git a/blog/2020-03-31-nushell_0_12_0.md b/blog/2020-03-31-nushell_0_12_0.md new file mode 100644 index 00000000000..050ec528e7c --- /dev/null +++ b/blog/2020-03-31-nushell_0_12_0.md @@ -0,0 +1,174 @@ +--- +title: Nushell 0.12.0 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: We're excited to release version 0.12.0 of Nu! +--- + +# Nushell 0.12.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're excited to release version 0.12.0 of Nu! + +# Where to get it + +Nu 0.12.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.12.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's new + +## Automatic `cd` (jonathandturner) + +``` +nushell on 📙 master is 📦 v0.12.0 via 🦀 v1.42.0 +❯ docs +nushell/docs on 📙 master +❯ .. +nushell on 📙 master is 📦 v0.12.0 via 🦀 v1.42.0 +``` + +Fish and Windows users rejoice, you can now `cd` to a directory or drive by typing its name in the shell. This also allows Windows users to change drives by giving just the drive name. Now, when you use the drive letter, we'll switch drives and return you to your previous working directory on that drive (eg `D:` will change to the D: drive and `cd` to the path you had been at previousy). + +## Type inference (andrasio) + +``` +❯ open tests/fixtures/formats//caco3_plastics.csv | get cif_per_net_weight +───┬───────── + # │ +───┼───────── + 0 │ 0.2300 + 1 │ 0.3100 + 2 │ 0.1400 + 3 │ 0.2300 + 4 │ 0.2100 + 5 │ 0.2800 + 6 │ 0.3000 + 7 │ 0.2500 + 8 │ 0.2800 +───┴───────── +nushell on 📙 master is 📦 v0.12.0 via 🦀 v1.42.0 +❯ open tests/fixtures/formats//caco3_plastics.csv | get cif_per_net_weight | sum +2.23 +``` + +We've been hard at work at improving how we read in unstructured data. In this release, you'll see the beginning of type inference as data is read in. In the above example, you can see how we now autodetect decimal numbers and then can later sum them together. + +## Jupyter notebook support (jonathandturner) + +![image of Nu in Jupyter notebook](../assets/images/0_12_0_jupyter.png) + +Nu's core design goal is that it should be easier to work with your system and your data. In this release, we take a step beyond being just a shell with [Jupyter notebook support](https://github.com/nushell/nu_jupyter). + +## `ls --all` (quebin31) + +``` +❯ ls +────┬─────────────────────────────────────────────────────┬──────┬──────────┬────────────── + # │ name │ type │ size │ modified +────┼─────────────────────────────────────────────────────┼──────┼──────────┼────────────── + 0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 5 months ago + 1 │ Cargo.lock │ File │ 104.5 KB │ 23 mins ago + 2 │ Cargo.toml │ File │ 5.5 KB │ 23 mins ago +... + +❯ ls --all +────┬─────────────────────────────────────────────────────┬──────┬──────────┬────────────── + # │ name │ type │ size │ modified +────┼─────────────────────────────────────────────────────┼──────┼──────────┼────────────── + 0 │ .azure │ Dir │ │ 2 weeks ago + 1 │ .cargo │ Dir │ │ 2 weeks ago + 2 │ .circleci │ Dir │ │ 2 weeks ago +... +``` + +With 0.12.0, you can now show hidden files when listing directory contents with `ls`. + +## `from-ics` and `from-vcf` (pulpdrew) + +The file support contines to improve, as we add support for vCard and iCal file formats. + +## `to-md` and `to-html` (jonathandturner) + +``` +❯ ls | to-md +|name|type|size|modified| +|-|-|-|-| +|CODE_OF_CONDUCT.md|File|3.4 KB|5 months ago| +|Cargo.lock|File|104.5 KB|21 mins ago| +``` + +You can now output to markdown and html using the new converters. + +## `headers` (samhedin) + +``` +❯ open tests/fixtures/formats/sample_data.ods | get SalesOrders +────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬─────────── + # │ Column0 │ Column1 │ Column2 │ Column3 │ Column4 │ Column5 │ Column6 +────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼─────────── + 0 │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total + 1 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500 + +❯ open tests/fixtures/formats/sample_data.ods | get SalesOrders | headers +────┬────────────┬─────────┬──────────┬─────────┬─────────┬───────────┬─────────── + # │ OrderDate │ Region │ Rep │ Item │ Units │ Unit Cost │ Total +────┼────────────┼─────────┼──────────┼─────────┼─────────┼───────────┼─────────── + 0 │ 2018-01-06 │ East │ Jones │ Pencil │ 95.0000 │ 1.9900 │ 189.0500 + 1 │ 2018-01-23 │ Central │ Kivell │ Binder │ 50.0000 │ 19.9900 │ 999.4999 +``` + +Sometimes when working with data, you've managed to read in columns of data and notice that the first row is the headers you want. Previously, this required a lot of twiddling to lift the row into being the header. With 0.12.0, this has become much simpler with the `header` command. + +## `ps --full` mode (jonathandturner) + +We're extending the information you can get back from `ps`. You are now able to get the original commandline and more for each process using the new `ps --full`. + +## `rm` can now take multiple arguments to remove multiple files at once (pulpdrew) + +Sometimes we're missing a feature and you wonder how we made it that long :D. In this release, you can now pass multiple files to `rm` for deletion. + +## Row rotation (jonathandturner) + +``` +❯ sys +─────────┬───────────────────────────────────────── + host │ [row 7 columns] + cpu │ [row cores current ghz max ghz min ghz] + disks │ [table 9 rows] + mem │ [row free swap free swap total total] + temp │ [table 8 rows] + net │ [table 4 rows] + battery │ [table 1 rows] +─────────┴───────────────────────────────────────── +``` + +When working with data with lots of columns, it can sometimes be a pain to watch it print to the screen only to see that the data is missing columns because they won't fit. In this version, we're experimenting with a way to help this by auto-rotating a row when it is printed by itself. This will allow more of the row to fit into the screen. + +## Configurable table headers (Amanita-muscaria) + +You may have noticed that the headers in the above examples were centered. How's that for sneaking a feature in? + +With 0.12.0, you can configure your table look a bit more by changing how the headers are displayed. Here are the new `config` settings: + +* header_color: Available colors are from term::color module +* header_align: Sets header alignment center/left/right +* header_style: Sets style bold, underlined, italic. More than one can be used + +## Lots of bugfixes/improvements (Sosthene-Guedon, quebin31, neuronull, andrasio, thegedge, vsoch, jonathandturner, jonstodle) + +Open no longer fails silently, improved CSV opening, improve canonicalize of filenames, `sys` now properly says user sessions, moved `shuffle` to being an internal command, relaxed file modes, cleaned up `which` implementation, fix Docker build matrix, streams can now be interrupted, improvements to `du`, `get` now will remove blank values for easier processing, respect CARGO_TARGET_DIR when set, allow `..` and `/` to be mv targets, + +## Documentation improvements (pulpdrew, nickgerace, waldyrious, kloun) + +Docs for `from-ics` and `from-vcf`, quickstart section for Docker users, docs for `skip` and `skip-while`, typos and whitespace fixes, typo in `calc` docs + +# Looking ahead + +"Just keep going!" as Yehuda Katz would say, and we intend to. Lots of internal improvements are coming, and of course aliases which has become a daily request. + +We'd also like to hear from you. Let us know what would make Nu work better for your workflows, drop us a line in [discord](https://discord.gg/NtAbbGn) or [github](https://github.com/nushell/nushell). We'd love to hear from you! diff --git a/blog/2020-04-21-nushell_0_13_0.md b/blog/2020-04-21-nushell_0_13_0.md new file mode 100644 index 00000000000..147fee37cc7 --- /dev/null +++ b/blog/2020-04-21-nushell_0_13_0.md @@ -0,0 +1,166 @@ +--- +title: Nushell 0.13.0 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: We're excited to release version 0.13.0 of Nu! This is by *far* one the the biggest releases, yet. Let's dive in! +--- + +# Nushell 0.13.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're excited to release version 0.13.0 of Nu! This is by *far* one the the biggest releases, yet. Let's dive in! + +# Where to get it + +Nu 0.13.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.13.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New +## Aliases (jonathandturner) + +Yes, it's true. Nu now supports aliases so that those long pipelines now have new life as concise, reusable commands. + +``` +> alias myecho [msg] { echo $msg } +> myecho "hello world!" +hello world! +``` + +The alias has a name, a list of optional parameters, and the block that will execute. This block can refer to the parameters using their variable names. + +## Startup commands (jonathandturner) + +With aliases, it's helpful to be able to start up Nu with your favorite aliases ready to go. To this end, we've now added the `startup` config variable. Adding a table of strings to this config variable enables you to run all of these commands as Nu starts up. + +``` +> config --set [startup ["alias myecho [msg] { echo $msg }"]] +``` + +You can read more about setting `config` variables in [the book](https://www.nushell.sh/book/en/configuration.html) + +## Multi-dot paths (quebin31) + +In some shells, you can use multiple dots to mean go back even more directories. In addition to the common `..`, to go back to the previous directory, you can now also use `...` to go back two directories, `....` to go back three, and so on. + +## Semicolon support (jonathandturner) + +A long standing annoyance when using Nu day in and day out is that you can't compose two different pipelines together. Sometimes you want to run a build, and then run the output of the build if it succeeds. + +In Bash, you might do something like this: + +``` +> make && ./run/my/app +``` + +If make succeeds, then your app runs. We're introducing the ';' separator which does this (beware bash users that this ';' will stop if the left-hand fails). You can write the above bash line as this in Nu 0.13.0: + +``` +> make; ./run/my/app +``` + +Note that commands that you may be used to printing to the terminal when you run them directly may not print anything when used on the left-hand side of the `;`. This is because the data comes out and, being structured, it just gets consumed before it's viewed. If you prefer to see the output of a command on the left of the `;`, you can pass it through `autoview` to do this for you: + +``` +> ls | autoview ; echo "done" +``` + +## Math operations (jonathandturner) + +Wish you had a calculator or want to do a quick computation on something in your table? With 0.13.0, you can now switch into "math mode" and do a quick calculation. To switch into math mode, use the `=` operator as the command name. + +``` +> = 3 + 4 +7 +``` + +You can use this in pipelines as well, do something like: + +``` +ls | get size | = $it + 1mb +``` + +It doesn't end there. Not only are the basic +, -, *, and / available, but you can use these new operators: + +### checking if a value is in a member of the given table with `in:` + +``` +> = a in: [a b c] +true +> = d in: [a b c] +false +``` + +### `&&` and `||` to create compound comparisons + +``` +> ls | where name > 'f' && size > 1kb +``` + +### Parens to allow grouping + +``` += (1 + 2) * (3 + 4) +21 +``` + + +## New parser logic (jonathandturner) + +Early in this release cycle, we began experimenting with different ways we could write the parser going forward. Being able to parse commands, where each command could dictate how the parser works for that command, is a special challenge of how Nu works. After a bit of experimenting, we found a way forward that quickly seemed to fix some of the long-standing bugs. Not only this, but it opened up the way for a set of new features. + +If you find issues with this new parser logic where code that used to work no longer works, please let us know. This will help us work out any issues as we build new features on it. + +## External improvements (thegedge, jonathandturner) + +With 0.13.0, we're taking a big step to making externals work in a way much more in-line with how internals work. This allows us to provide better support for varibles, column paths, coloring, error handling, and more. + +## Many bugfixes and improvements (DrSensor, thegedge, quebin31, jonathandturenr, avendesa, and more) + +* Better docker publish for each release (DrSensor) +* Correctly delete symlinks (thegedge) +* Better path canonicalization (quebin31) +* Simplify `cp` and allow recursive copying (quebin31) +* Make trash optional (jonathandturner) +* Add support for `$true` and `$false` (jonathandturner) +* Fixes for a few path and `where`-related issues (avendesa) +* Plus fixes in our dependencies, many thanks to those crate owners! + +## Pipeline blocks and the new `each` command (jonathandturner) + +Starting with 0.13.0, blocks can now contain pipelines (including `;`-separated multiple pipeline blocks). This allowed us to create the first command to take advantage of this: `each`. The new `each` command will run over each row in a table and do something for each. For example, let's say you wanted to convert each row of a table to separate JSON, rather than converting the whole table: + +``` +> ls | each { to-json } +``` + +## Breaking changes + +With the math operations above, we're now changing the default type of syntax in a block. Where as before, the expanded version of where was: + +(0.12.0) +``` +> ls | where { $it.size > 10kb } +``` + +(0.13.0) +``` +> ls | where { = $it.size > 10kb } +``` + +This is because blocks are now pipelines by default, so you need the extra `=` to switch into the math mode, which allows using the comparison operator `>`. + +You can also still use the shorthand versions of these comparisons: + +``` +> ls | where size > 10kb +> ls | where $it.size > 10kb +``` + +# Looking forward + +With 0.13.0, we've landed some important features that fill in gaps for using Nu as your daily driver, and we're excited to hear from our users. Looking forward, there's a lot of polish we'd like to put on these new features, including updating the book, cleaning up the code, writing more test cases, and fixing some of our bug backlog. This will also give us time to "kick the tires" on these new features as well, using them in our day-to-day work. We're currently planning for the following release to be more focused on "polish". After this, of course, there are many more features to come! diff --git a/blog/2020-05-12-nushell_0_14_0.md b/blog/2020-05-12-nushell_0_14_0.md new file mode 100644 index 00000000000..ed6eaa28ae5 --- /dev/null +++ b/blog/2020-05-12-nushell_0_14_0.md @@ -0,0 +1,148 @@ +--- +title: Nushell 0.14.0 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: We're excited to release version 0.14.0 of Nu! +--- + +# Nushell 0.14.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +We're excited to release version 0.14.0 of Nu! + +# Where to get it + +Nu 0.14.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.14.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## Temporary environment variables (jonathandturner) + +A feature requested by many, many folks is finally here. Up until now, to change an environment variable, you had to update the `config` settings, and then these changes would be permanent. This makes working with certain kinds of commands, which need some additional environment information, annoying to use. + +With 0.14.0, you'll now be able to temporarily set an environment variable. To do so, you can use the new `with-env` command. This command takes the variable/value pair and the block to run once the environment is set: + +``` +> with-env [DEBUG true] { command arg1 arg2 } +``` + +Bash, as well as many other shells, use a handy shorthand form, which we also now support. You can write the above as: + +``` +> DEBUG=true command arg1 arg2 +``` + +## Starting things off right (1ntEgr8) + +Modern desktops have a way to associate file types with applications and often have a way to run that application automatically when you open a file of that type. In macOS, you can use the `open` command, `start` on Windows, and a variety of related `start` command in Linux. + +In 0.14.0, we've added a unified `start` command that works across platforms that will run the associated application for a file type. For example, if you've associated your .py files with VSCode, you can edit them now using `start myfile.py`. + +## Nu gets a calendar (JosephTLyons) + +A fun surprise for this release is the recently-added `cal` command, which will give you a calendar in table form. + +``` +> cal +───┬────────┬────────┬─────────┬───────────┬──────────┬────────┬────────── + # │ sunday │ monday │ tuesday │ wednesday │ thursday │ friday │ saturday +───┼────────┼────────┼─────────┼───────────┼──────────┼────────┼────────── + 0 │ │ │ │ │ │ 1 │ 2 + 1 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 + 2 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ 16 + 3 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 + 4 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 + 5 │ 31 │ │ │ │ │ │ +───┴────────┴────────┴─────────┴───────────┴──────────┴────────┴────────── +``` + +You can pass in flags to give you additional columns for the year, month, and even get calendars from the past or future. + +## Commands get some helpful examples (elichai) + +A last minute update also gave us a big improvement in our built-in help. Starting with 0.14, we'll now have examples as part of the help commands can use: + +![image of new command help with colored example](../assets/images/0_14_0_help_examples.png) + +We're working to add examples to all commands. If that's something you're interested in helping with, come join us on [discord](https://discord.gg/NtAbbGn). + +## Subcommands (jonathandturner) + +As we fill out more forms of commands that Nu can represent, one type that we weren't able to do was subcommands. This meant all of our commands were at the top level, making it more difficult to find what you needed. Additionally, many external commands use subcommands, which meant we had no way to effectively wrap them in Nu. + +With 0.14, you can now define subcommands. Subcommands each get a unique signature which has its own coloring, autocomplete, etc. + +``` +> open myfile.txt | from csv --headerless +``` + +## Breaking changes: renaming some commands (jonathandturner, andrasio) + +You may have noticed above that the `from-csv` is now `from csv`, that is, the `csv` part is now a subcommand of the `from` command. We've moved all `from-*` and `to-*` commands to be subcommands. This change was requested by users as part of an effort to streamline how conversion commands work. + +Another set of changes requested by users was to update the names of some of the commands to the more common forms: + +* `pick` is now `select`. This matches more closely with SQL, LINQ, and shells with similar functionality. +* `edit` is now `update` + +While we are cautious to take breaking changes, we're confident - judging from user feedback - that these changes make Nu more ergonomic and easier to learn. + +## `ls` learns read directory sizes (JosephTLyons) + +A few users have wondered why Nu doesn't print the full directory size as part of `ls`. With 0.14, you'll now be able to get just that with the new `--du` argument to `ls`. Note: this isn't enabled by default as calculating the directory size can take quite a lot of processing. + +## Startup speedups (fdncred) + +It's important to make a good first impression, and with this release Nu gets a speed boost for the initial startup. It will now load plugins in parallel rather than one after another. In some cases, this can lead to startups 3x-4x faster than previous versions. + +## Auto-cd speedups (quebin31) + +We've also gotten a boost when using the automatic change directory. You'll notice that 0.14 is a lot snappier when you type a directory to automatically jump to. + +## Lots of new commands + +* `from eml` (aeshirey) - have lots of saved emails lying around and want to process them? With 0.14, you can now easily load them into Nu +* `empty?` (andrasio) - you can now check multiple columns for emptiness, and if empty, give them a value +* `skip-until`, `keep-while`, `keep-until` (andrasio) - similar to `skip-while`, you can optionally `skip` or `keep` rows if they meet a condition or until they meet a condition +* `merge` (andrasio) - ever have two related tables and wish you could merge them into one? The new `merge` command can help you do that +* `not-in:` operator (jonathandturner) - going along with the `in:` operator is the new `not-in:`, which checks that a value isn't in the given list + +## It-expansion (jonathandturner, thegedge) + +We've streamlined how `$it` is handled. The `$it` variable has always implied iteration (`$it` gets the name from iteration, item, and being "it"). In 0.14, we've made this more explicit with an expansion that happens inside of Nu. + +Now, with Nu sees an `$it`, it expands it to a full `each` call. + +``` +> ls | echo $it.name +``` + +Internally, now expands to: + +``` +> ls | each { echo $it.name } +``` + +This helps us be more uniform about when iteration will happen. We've also updated how externals are handled so they can take advantage of this, making them work a lot more closely with how internals work. + +## Doc and book updates (nespera, jonathandturner, fdncred, jzaefferer, siedentop) + +We're continuing to fill out help information on each of the commands. This release adds a few more to the list of documented commands. + +The [book](https://www.nushell.sh/book/en/) has also gone through a big revision to bring it up-to-date with the 0.14 release. We've also added tables to help you transition from Bash, PowerShell, SQL, and LINQ. A big thanks to our contributors to help find and fix issues. There's more work to do here. If you're writing-inclined, come join us! + +## Bugfixes and polish (quebin31, BurNiinTree, avandesa, pka, homburg, rimathia, thegedge, jonathandturner, mhmdanas, JesterOrNot) + +Lots of bugfixes and polish for this release. A big "thanks!" to everyone that joined in and filed bugs, fixed bugs, and gave feedback on discord, github, and twitter. + +# Looking forward + +We've got lots of fun things planned for upcoming releases: more intelligent autocomplete, autocomplete for popular external commands, and more streamlining of the engine itself. + +If you'd like to help out by writing code, writing docs, helping with the website, or just have an idea, come join us on [discord](https://discord.gg/NtAbbGn) or [github](https://github.com/nushell/nushell). We'd love to hear from you! diff --git a/blog/2020-06-09-nushell_0_15_0.md b/blog/2020-06-09-nushell_0_15_0.md new file mode 100644 index 00000000000..5e4fb9711b7 --- /dev/null +++ b/blog/2020-06-09-nushell_0_15_0.md @@ -0,0 +1,193 @@ +--- +title: Nushell 0.15.0 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.15 of Nu - and it has a few last-minute surprises we hope you'll find as much fun as we do. +--- + +# Nushell 0.15.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.15 of Nu - and it has a few last-minute surprises we hope you'll find as much fun as we do. + +As many of you know, this release was delayed as part of a wide-spread effort to elevate Black voices and raise awareness of police violence, a movement which has now grown worldwide. We encourage you to take time to understand what this movement stands for, why it's happening, and to get involved where you can. + +# Where to get it + +Nu 0.15.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.15.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## Per-directory environment variables (samhedin) + +Right before the announcement of 0.15, we had a surprise feature land - per-directory environment variables. This allows you to configure some environment variables specific to the directory (including subdirectories) that you're currently in, and Nu will set these environment variables as you `cd` into the directory and unset them as you `cd` out. + +How it works: + +In your config, create a new config setting called `nu_env_dirs` and set it to a list of directories you want to allow to control their own environments: + +``` +> config --set [nu_env_dirs ["/home/sam", "/home/sam/github", "/home/sam/github/test"] +``` + +Note: after setting the above config settings, restart Nu so that they can be picked up. + +Once set, you can now create a `.nu-env` file in the directory that you want to control the environment in: + +``` +> open .nu-env +[env] +var = "value" +anothervar = "anothervalue" +``` + +With this file in place, you can `cd` into one of the directories you've configured and see the new environment variables now available. + +## Improvements to auto-complete (AaronC81) + +Starting with 0.15, you can now get autocompletions for external commands in your PATH. + +Additionally, auto-completing a filepath with a space now is handled with cleaner logic than in previous versions. + +## Argument invocation (jonathandturner, cjpearce) + +You're now able to run a pipeline inside of another command as an argument, and then use the results that come out. + +``` +> echo $(ls | where size > 10kb | count) +3 +``` + +## String interpolation (jonathandturner) + +We also support string interpolation, or building a string from text and running commands. For example, if we wanted to print out the current path to the history file with a message, we could do: + +{% raw %} +``` +> echo `My current history path is {{$nu.history-path}}` +My current history path is /home/jonathant/.local/share/nu/history.txt +``` +{% endraw %} + +## Prettier errors (jonathandturner, brendanzab) + +We've switched from language-reporting to codespan, giving us nicer looking errors: + +![image of a prettier error message](../assets/images/0_15_0_prettier_errors.png) + +## Big history by default (aeosynth, lightclient) + +Let's start with 100k line history. You can also configure the history size using the new "history_size" config setting. + +## Command updates + +### `alias` now has a `--save` flag to save the alias to your config startup (1ntEgr8) + +Ever have an alias you wanted to save but then had to look up all the steps to do so? Haven't we all. + +With 0.15, it's easy to save an alias you like by using the `--save` flag. + +### Add `str to-decimal` (k-brk, routrohan) + +You can now easily parse decimal (sometimes called real or floating point numbers) using the new `str` subcommand. + +### `fetch` now can take username/password (he4d) + +Like its counterpart `post`, `fetch` can now accept a username/password to login to fetch URL contents. + +### `average` now works over tables (andrasio) + +In addition to using `average` on a column, you can now run it over a whole table. + +### `start` now supports glob paths (arashout) + +You can now pass multiple values to `start` at one time using the new glob support. + +``` +> start file*.rs +``` + +### Plugins no longer scan whole PATH (jonathandturner, fdncred) + +As we looking into startup times, we saw that scanning the whole PATH for plugins is quite costly. Even more, few people had used the feature to put plugins in a different directory than the `nu` application itself. + +With 0.15, by default we will only look in the directory of the `nu` application. You can still manually store your plugins elsewhere by adding directories to the new "plugin_dirs" config setting. + +### `echo` now will iterate over a range (jonathandturner) + +``` +> echo 1..3 +───┬─── + 0 │ 1 + 1 │ 2 + 2 │ 3 +───┴─── +``` + +### `where` command speedups (jonathandturner) + +We did some work to optimize how command blocks are executed, which helps to speed up `where` quite a bit for long running queries. + +### `du` can now be canceled with ctrl-c (JosephTLyons) + +For those long-running `du` runs that you want to stop short, you can now use `ctrl-c` to exit back to Nu. + +### `with-env` shorthand now works with quoted strings as well (k-brk) + +Now support: passing a string as a value in environment shorthands: + +``` +> FOO="My Bar" command arg1 arg2 +``` + +### Add config option for "rm_always_trash" (filalex77) + +If you'd prefer to always `rm` to the recycle bin instead of permanently deleting, you can enable the new "rm_always_trash" config setting. + +### `parse` now also takes a `--regex` flag (filalex77) + +For when you need to do a bit more serious parsing work, you can now use regex from inside of the `parse` command. + +### Various improvements to auto-pivot (fdncred, Samboy218) + +Previously, we always auto-pivoted the single row. Now, you can configure whether or not you want the row to pivot before it's displayed, including a new heuristic mode that will attempt to only pivot the row if necessary. + +### `histogram` now has a count (JosephTLyons) + +You'll now be able to see the count of each of the rows in the histogram. + +### `format` can now access variables as well as column names (jonathandturner) + +Previously, `format` would only allow you to pass in column names. This meant that also printing a variable's value was a bit convoluted. With 0.15, you can pass in either a column name, or a variable (including a full variable path like `$nu.history-path`) + +### `to json` now has pretty printing support (JosephTLyons) + +You can now get `to json` to give you pretty-printed output, using the new `--pretty ` flag. + +``` +> echo $nu | to json --pretty 2 +``` + +### Consumers of `nu-cli` can now register custom commands (daschl) + +If you're building applications and want to use `nu` as a library instead of directly as a cli, it's now possible to pass in your own set of custom commands that Nu will enable as internal commands. + +## Doc and book updates + +Contributor "zombie110year" has been working on translating the book to Simplified Chinese. If you'd like to help, let us know! + +Also thanks to mhmdanas, andrasio, shiena, q-b, jzaefferer, Samboy218, ryepesg, 0xABAD, sseering, hilias, Dimagog, and fdncred for contributing to the book and continuing to help make it better. + +## Bugfixes and polish (daschl, JosephTLyons, utam0k, arashout, andrasio, fdncred, johnae, jonathandturner, thegedge, shaaraddalvi, notryanb, EmNudge, Kelli314, coolshaurya, johnterickson, klnusbaum, AdminXVII, Delapouite, hdhoang) + +There are *far* too many improvements and bugfixes to list here, but another *huge* thank you to everyone who has helped fix an issue, report an issue, chatted with us on twitter and discord, and just shared your love for Nu with others. + +# Looking forward + +With 0.15, we've closed another set of gaps in what people need in a shell. We're looking to continue improving completions, as well as growing the parser to support Nu scripts not just line-by-line, but as whole source files. We're also working on improving jupyter support, file encoding for better support across languages, and more. diff --git a/blog/2020-06-30-nushell_0_16_0.md b/blog/2020-06-30-nushell_0_16_0.md new file mode 100644 index 00000000000..2f591e08468 --- /dev/null +++ b/blog/2020-06-30-nushell_0_16_0.md @@ -0,0 +1,166 @@ +--- +title: Nushell 0.16.0 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.16 of Nu. What's new? +--- + +# Nushell 0.16.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.16 of Nu + +# Where to get it + +Nu 0.16.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.16.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## New automated release binaries (charlespierce, fdncred, jonathandturner) + +Up to this point, we've hand-rolled all the binary releases. The process has been time-consuming and error-prone. Starting with 0.16.0, we'll be releasing using the GitHub release automation. The first benefits you'll see is that we've also added a wix-based installer for Windows users. The second, perhaps harder to see, benefit is a more relaxed release process that's easier on the project maintainers :) + +Please note: as part of this, we took the opportunity to also align the directory structure across platforms. Apologies in advance for any inconvenience this might cause. + +## New textview (fdncred) + +We've had a few requests for an improved text viewing experience, so with 0.16.0 we're trying out a new viewer based on the [bat](https://crates.io/crates/bat) crate. We also support quite a lot of [configuration settings](https://github.com/nushell/nushell/pull/2010) for this new text viewer. + +## New commands + +### Let's get `random` (JosephTLyons) + +We have a new top-level command: `random`. To start, there are three sub-commands: + +* `random uuid` - generate random UUIDs +* `random bool` - a random "coin flip" with optional bias +* `random dice` - roll a single or a set of dice, optionally setting the number of sides and number of dices + +### More `math` (JosephTLyons, arashout, andrasio, amousa11) + +We've consolidated and added to our math operations. Now available as part of the 0.16.0 release: + +* `math avg` - averages a list of numbers +* `math sum` - totals a list of numbers +* `math mode` - gets the mode of a list of numbers +* `math median` - gets the median of a list of numbers +* `math min` - gets the minimum value of a list of numbers +* `math max` - gets the maximum value of a list of numbers + +### Other commands + +* [`every`](https://github.com/nushell/nushell/pull/1992) - lets you skip every n-rows (kubouch) +* `ansi` - lets you output ANSI color codes to color your strings (jonathandturner, fdncred) +* `char` - makes it possible to output newlines and tabs (jonathandturner) +* `do` - runs a block to completion, optionally ignoring errors (jonathandturner) + +## Custom prompts (jonathandturner) + +You can now run a pipeline which returns a string, or list of strings, that is used to create a custom prompt. To do so, set the pipeline you want to use in the config for the `prompt` setting. + +A simple example: + +``` +> config --set [prompt "echo '> '"] +``` + +We've also added a new `ansi` command to let you change the color. Let's use it to change the prompt to blue: + +``` +> config --set [prompt "echo $(ansi blue) '> '"] +``` + +You can make the prompt even fancier. For example, this prompt prints the current directory, git branch, and current date and time: + +``` +> config --set [prompt 'echo [ $(ansi green) $(pwd) $(ansi reset) $(do -i {git rev-parse --abbrev-ref HEAD } | trim | echo [ "(" $(ansi blue) $it $(ansi reset) ")" ] | str collect) $(char newline) $(ansi cyan) $(date --format "%d/%m/%Y %H:%M:%S").formatted $(ansi reset) "> " ]'] +``` + +![image of full prompt](../assets/images/0_16_0_prompt_3.png) + +*Example of full prompt* + +Or update your prompt to show an abbreviated path: + +``` +> config --set [prompt 'echo [ $(ansi green) $(pwd | split row "/" | first $(pwd | split row "/" | count | = $it - 1 ) | each { str substring "0,1" | format "{$it}/" } | append $(pwd | split row "/" | last ) | str collect) $(do -i { git rev-parse --abbrev-ref HEAD | trim | echo $(ansi reset) "(" $(ansi blue) $it $(ansi reset) ")" | str collect }) $(ansi reset) "> "]'] +``` + +(note: the above assumes Unix-based systems, so on Windows use "\" as the path separator)) + +![image of abbreviated prompt](../assets/images/0_16_0_prompt_4.png) + +*Example of abbreviated prompt* + +## RFC process (jzaefferer) + +We now have an [RFC process](https://github.com/nushell/rfcs) if you want to propose new features and breaking changes to Nu. Come let us know what you think and share your vision with us. + + +## Starship becomes optional (fdncred) + +We've made enabling starship a configuration option, rather than always being on. This allows you to opt-in, if you'd like the starship experience, but removes the requirement that you have to know to build without starship if you'd rather not have it (which may not be possible if you're using binary releases). + +To enable starship, set the `use_starship` setting: + +``` +> config --set [use_starship $true] +``` + +## New table drawing (jonathandturner) + +With 0.16.0, we now use a new table drawing algorithm. Here's the before and after for comparison: + +![image of a table before](../assets/images/0_16_0_before_table.png) + +*Table drawn with 0.15.0* + +![image of a table before](../assets/images/0_16_0_after_table.png) + +*Table drawn with 0.16.0* + +If you're struggling to see much difference, that's a good thing! Where you'll really see the difference is in the time it takes to draw these tables: + +![image of a table before](../assets/images/0_16_0_rendering_time.png) + +*0.16.0 renders tables 40% faster than 0.15.0* + +## Simplified Chinese Nu book (zombie110year) + +Over the past few weeks we've seen steady progress on the Simplified Chinese translation of the Nu book. With this release, another set of translated chapters were added. + +## Command improvements + +* `to toml` now properly disallows incorrect top-level values (arashout) +* `mkdir` can now optionally show the names of directories created (utam0k) +* `uniq` can now optional provide the counts of each value in the result (siedentop) +* `cal` will now allow you to configure the start day of the week (JosephTLyons) +* Division by zero is now an error that's caught and shown to the user (bailey-layzer) +* `date` can now output formatted datetime strings (fdncred) +* Docs added for autoview, touch, and pwd (orientnab) +* New `str collect` allows you to join a list of strings into a single string (jonathandturner) +* Wix build support (fdncred) +* Fixes for running external commands using the new Windows links feature (fdncred) +* `open` can now optionally take an encoding (fdncred) +* The `config` settings file can now be readonly (jonathandturner) + +## Internal improvements + +* Replaced use of `async_stream` macro with creating async streams directly (JosephTLyons, jonathandturner) +* Fixes to the `ps` process time algorithm (svartalf) +* Interruptible stream API is now public (daschl) +* We now test Windows drive changing during our CI tests (HiranmayaGundu) +* Errors are now bubbled up earlier when possible (jonathandturner) +* Config loading no longer panics if it doesn't succeed (jonathandturner) +* Clean up and formatting of our docs (JosephTLyons) +* Optimization work to not clone in some places (utam0k) + +# Looking ahead + +We are looking into a few areas for the next release: further improving our per-directory environments, improving compile times, continuing to do code cleanup and pay down tech debt, and possibly more. diff --git a/blog/2020-07-21-nushell_0_17_0.md b/blog/2020-07-21-nushell_0_17_0.md new file mode 100644 index 00000000000..24b93f61191 --- /dev/null +++ b/blog/2020-07-21-nushell_0_17_0.md @@ -0,0 +1,204 @@ +--- +title: Nushell 0.17.0 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.17 of Nu, the first Nu to include WebAssembly, custom keybindings, and much more. +--- + +# Nushell 0.17.0 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.17 of Nu, the first Nu to include WebAssembly, custom keybindings, and much more. + +# Where to get it + +Nu 0.17.0 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.17.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## WebAssembly support (jonathandturner) and upcoming wasm-based playground (jzaefferer, jonathandturner) + +![image of a wasm-based NuShell playground](../assets/images/0_17_0_playground.png) + +_Nu, now in your browser_ + +As part of on-going cleanup and portability work, with 0.17 it's now possible to build Nu and target WebAssembly, allowing you to run Nu in the browser and call into it from JavaScript. This is the first (experimental!) step in building towards an interactive playground and possibly more. We're hoping to talk more about this porting process in the coming days. + +If you'd like to see what we're building, [check it out](https://www.nushell.sh/demo/). + +## Custom keybindings (jonathandturner) + +Nushell now also supports custom keybindings. To configure your keybindings, you can add a keybindings.yml file beside your config file. You can find out the location for your system using: + +``` +> echo $nu.keybinding-path +/home/jonathan/.config/nu/keybindings.yml +``` + +You can base your custom file off this [example keybindings file](https://github.com/nushell/nushell/blob/main/docs/sample_config/keybindings.yml). + +## New commands + +### `benchmark` (pag4k) + +The new `benchmark` command will time a block and output the length of time it took to run: + +``` +> benchmark { echo "hello" } +363us 528ns +``` + +### `str reverse` (JosephTLyons) + +The `str reverse` command will reverse the characters of a string: + +``` +> echo "hello world" | str reverse +dlrow olleh +``` + +### `str length` (jonathandturner) + +On a related note, you can now also get the length of a string. + +``` +> echo "hello world" | str length +11 +``` + +### `str from` (bailey-layzer) + +In previous versions of Nu, it was difficult to format numbers for precision and digit grouping. Starting with 0.17, there's now a new `str from` subcommand to help with this. + +``` +> echo 1.456123 | str from --decimals 2 +1.46 + +> echo 1234567 | str from --group-digits +1,234,567 +``` + +### `math stddev` and `math variance` (amousa11) + +You can now calculate standard deviation and variance in your numeric datasets: + +``` +> echo [ 1 2 3 4 5 ] | math stddev +1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573 + +> echo [ 1 2 3 4 5 ] | math variance +2 +``` + +### `if` (jonathandturner) + +Ever want to run one block if a condition was true and another if the condition was false? Now you can! + +``` +> echo 0..5 | if $it > 3 { echo big } { echo small } +───┬─────── + 0 │ small + 1 │ small + 2 │ small + 3 │ small + 4 │ big + 5 │ big +───┴─────── +``` + +The keen observer might notice we're stealthly sneaking in more commands you might use in future scripting. + +### `split chars` (jonathandturner) + +To more easily work with the characters in a string, you can now split the characters into separate items: + +``` +> echo "hello" | split chars +───┬─── + 0 │ h + 1 │ e + 2 │ l + 3 │ l + 4 │ o +───┴─── +``` + +### `move column` (andrasio) + +Finally, you can now move columns in your table: + +``` +> ls +───┬──────────────────────────────────┬──────┬─────────┬──────────── + # │ name │ type │ size │ modified +───┼──────────────────────────────────┼──────┼─────────┼──────────── + 0 │ 0.bootstrap.js │ File │ 30.9 KB │ 1 hour ago + 1 │ 46a44c28f12d33243854.module.wasm │ File │ 5.4 MB │ 1 hour ago + 2 │ bootstrap.js │ File │ 16.3 KB │ 1 hour ago + 3 │ index.html │ File │ 1.4 KB │ 1 hour ago +───┴──────────────────────────────────┴──────┴─────────┴──────────── + +> ls | move column size --before type +───┬──────────────────────────────────┬─────────┬──────┬──────────── + # │ name │ size │ type │ modified +───┼──────────────────────────────────┼─────────┼──────┼──────────── + 0 │ 0.bootstrap.js │ 30.9 KB │ File │ 1 hour ago + 1 │ 46a44c28f12d33243854.module.wasm │ 5.4 MB │ File │ 1 hour ago + 2 │ bootstrap.js │ 16.3 KB │ File │ 1 hour ago + 3 │ index.html │ 1.4 KB │ File │ 1 hour ago +───┴──────────────────────────────────┴─────────┴──────┴──────────── +``` + +## Early draft of a new website (pontaoski) + +We're working on a refresh of our website. If you're interested in giving it a look, we've got an [early draft started](https://github.com/nushell/website_exploration). If you'd like to help us with the design, reach out over github or discord. + +## Command improvements + +- `sort-by` can now sort with case-insensitivity (JosephTLyons) +- `alias` of externals should now be improved (bailey-layzer) +- `history` should be able to correctly store more than 100 rows now (fdncred) +- `to html` will now output pretty hex when given a binary it doesn't recognize (jonathandturner), and now has color themes (fdncred) +- `uniq` can now also work with simple values (k-brk) +- Completions now have their own abstraction, so we can more easily improve them in the future (thegedge) +- `table` now prints column numbers a bit more orderly way (Porges) +- `str` made parsing more strict, to let the user know if there were parsing errors (andrasio) +- `group-by` can now take a block that allows for deep keying for grouping (andrasio) +- autoenv (directory-specific environments) can now run commands on entry/exit (samhedin) +- `str trim` can now take an optional character to trim (bailey-layzer) +- duration pretty-print is now easier to read (jonathandturner), durations are also now stored as nanoseconds internally (pag4k) +- `str substring` supports more argument types now (andrasio) +- completions for filepaths should now work in more cases (almindor) +- `rm` now gives nicer output (arashout) +- `ls -f` will now do a better job of keeping the tables aligned (arashout) +- general parser improvements (philip-peterson, jonathandturner) +- `each` can now number the outputs it creates, allowing for enumeration (jonathandturner) + +## Bug fixes, tests and more (philip-peterson, JosephTLyons, u5surf, thegedge, arashout, jonathandturner) + +Parsing now has more test coverage. Internal code cleanups. Command description copy paste issues fixed. Ensure that the MaybeTextCodec gets properly cleared. Fix documentation to renamed subcommands and `str to-int`. Internally more commands were moved to process their streams lazily. We can now generate documentation from reading the built-in docs on each command. + +## Breaking changes + +### BSON and Sqlite move to plugins (jonathandturner) + +As part of the portability work, we've moved the `from bson`, `to bson`, `from sqlite` and `to sqlite` out of internal commands and into plugins. The functionality should remain largely unchanged, with the only difference being that you'll need to install these plugins for this functionality. + +### Command renames + +- `calc` is now `math eval` to join the `math` subcommand family (coolshaurya) +- `keep-until` and `keep-while` are now subcommands: `keep until` and `keep while` (k-brk) +- `skip-while` and `skip-until` are also now subcommands: `skip while` and skip until (andrasio) +- `config` is now split into subcommands based on the command flag, eg) `config set`, `config get`, etc. (ritobanrc, jonathandturner) + +## Looking forward + +Just when we think we'll slow down a little, we're surprised by the amount of community feedback and help. This release covered nearly 4(!) pages of pull requests. Not bad for three weeks for work! + +There's some parser work coming up to help continue removing roadblocks to using Nu as a scripting language, improving completions, and generally continuing to polish Nu. diff --git a/blog/2020-08-11-nushell_0_18.md b/blog/2020-08-11-nushell_0_18.md new file mode 100644 index 00000000000..bcbbdf88dab --- /dev/null +++ b/blog/2020-08-11-nushell_0_18.md @@ -0,0 +1,65 @@ +--- +title: Nushell 0.18 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.18 of Nu. The focus of this release was largely to polish what is already there, ensuring that internally parts work together better, are more consistent, and are easier to maintain. We've also added new commands for working with paths, URLs, strings, and lists. +--- + +# Nushell 0.18 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.18 of Nu. The focus of this release was largely to polish what is already there, ensuring that internally parts work together better, are more consistent, and are easier to maintain. We've also added new commands for working with paths, URLs, strings, and lists. + +# Where to get it + +Nu 0.18 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.18.1) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want more goodies, you can install `cargo install nu --features=stable`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +*Please note:* as part of last minute changes, we had to bump the first release version of 0.18 to 0.18.1 instead of 0.18.0. + +# What's New + +## Command improvements + +- **New:** [`reduce` command](https://github.com/nushell/nushell/pull/2292) to reduce a list of values into a value (bailey-layzer) +- **New:** [`path basename`, `path extension`, `path expand`](https://github.com/nushell/nushell/pull/2255) for working with path values (mattyhall) +- **New:** [`path type` and `path exists`](https://github.com/nushell/nushell/pull/2264) for more path-related functionality (mattyhall) +- **New:** [`str ltrim` and `str rtrim`](https://github.com/nushell/nushell/pull/2262) to trim off left-hand and right-hand characters (k-brk) +- **New:** [`str starts-with` and `str ends-with`](https://github.com/nushell/nushell/pull/2269) to check if a string begins or ends with a given substring (k-brk) +- **New:** the [`url` subcommands](https://github.com/nushell/nushell/pull/2274) for dealing with URLs (mattyhall) +- The history file path is [now configurable](https://github.com/nushell/nushell/pull/2320) (Amanita-muscaria) +- The startup banner can now be [turned off](https://github.com/nushell/nushell/pull/2314) (avranju) +- `version` now contains the [features](https://github.com/nushell/nushell/pull/2333) that Nu was built with (andrasio) +- `math stddev` and `math variance` can now [sample the input](https://github.com/nushell/nushell/pull/2310) (andrasio) +- `do -i` will also [ignore stderr output](https://github.com/nushell/nushell/pull/2309) from external commands (jonathandturner) +- `to html` now has [many themes to choose from](https://github.com/nushell/nushell/pull/2308) (fdncred) +- `to html` also now has [list output](https://github.com/nushell/nushell/pull/2273) (coolshaurya) +- More of the line editor settings are [now configurable](https://github.com/nushell/nushell/pull/2238) (fdncred) +- `str to-datetime` can now [parse many more date formats](https://github.com/nushell/nushell/pull/2303) (nmandery) +- `str collect` now optionally takes [a separator value](https://github.com/nushell/nushell/pull/2289) (coolshaurya) +- `histogram` can now [work with simple values](https://github.com/nushell/nushell/pull/2300) (andrasio) +- `ls -al` (and `ps -l`) are now the preferred way of getting a full listing (JosephTLyons) +- `insert` now [takes a block](https://github.com/nushell/nushell/pull/2265) to do the work of inserting values (coolshaurya) + +## Breaking changes + +The flags for --full in `ls` and `ps` has been changed to --long (-l) to better align with habits from other shells. + +Line editor config settings have [moved to their own section](https://github.com/nushell/nushell/pull/2238). + +## Demo site (jzaefferer, jonathandturner) + +There have been a number of improvements to the new wasm-based demo site, including new colors, command improvements, pivoting of long tables, and more. + +## Bugfixes (fdncred, kornelski, JosephTLyons, andrasio, thegedge, jonathandturner, jzaefferer, warrenseine, coolshaurya) + +Fixed issues with different types of symlinks on Windows, Nu will now used the support app_dirs crate, lots of internal match logic cleanup, internal representation of data summaries got a cleanup, getting ready to add a winget package, the first wave of parser cleanups ahead of future completion work, cleaned up unnecessary extra build steps, new command examples, improvements to the new `path` command errors, fixed histogram example, and consistency improvements. + +# Looking forward + +We're nearly to the first birthday for Nu! In the near future, we'll continue to improve completions, work on a possible new [data frames](https://github.com/nushell/rfcs/pull/3) implementation, continuing to push the wasm implementation futher, and more. diff --git a/blog/2020-08-23-year_of_nushell.md b/blog/2020-08-23-year_of_nushell.md new file mode 100644 index 00000000000..61a1d2e3736 --- /dev/null +++ b/blog/2020-08-23-year_of_nushell.md @@ -0,0 +1,272 @@ +--- +title: One year of Nushell +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Hard to imagine that it's already been a year since Nu first went public. A year later and we've learned a lot, and made a few mistakes along the way. In this post, we look back over the year and see how we did and where we might be going in the future. +--- + +# One year of Nushell + +Hard to imagine that it's already been a year since Nu first went public. At the time, it was largely a demo of what could be possible, but still needed quite a bit of work to make it ready for everyday use. A year later and we've learned a lot, and made a few mistakes along the way. In this post, we look back over the year and see how we did and where we might be going in the future. + +# History + +When Nu first started, it started with a simple idea: the output of `ls`, `ps`, and `sysinfo` should all output the same thing. Taking a page from PowerShell, we explored outputting structured data and quickly settled on a table design that would support the output of each of the three commands, with the added ability of streaming the output as it became available. + +Around this idea, we then built a set of "filters", like the `where` clause, borrowed from SQL, and a growing set of data types we would support natively. Soon, we were able to write more complex statements like `ls | where size > 10kb`. This became the crux of the idea - commands that output values from a core set of data types into a stream, composed together with the traditional UNIX pipe (`|`), so that you could build up a complex set of commands that work over the data as it streams through. + +# Nushell today + +## Contributors + +Before we got started talking about Nushell today, we wanted to give a *big* "thank you!" to everyone who has contributed to Nu to get us to this point. Nu is what it is because of your help. + +1ntEgr8, AaronC81, AdminXVII, aeosynth, aeshirey, aidanharris, almindor, Aloso, Amanita-muscaria, amousa11, andrasio, Andrew-Webb, arashout, arnaldo2792, avandesa, avranju, bailey-layzer, BatmanAoD, bndbsh, Bocom, boisgera, Borimino, BradyBromley, BurNiinTRee, Byron, candostdagdeviren, casidiablo, charlespierce, chhetripradeep, cjpearce, coolshaurya, cristicismas, DangerFunPants, daschl, daveremy, davidrobertmason, Delapouite, dependabot[bot], Detegr, devnought, Dimagog, djc, drmason13, DrSensor, elichai, eltonlaw, EmNudge, eoinkelly, equal-l2, est31, fdncred, filalex77, Flare576, gilesv, gorogoroumaru, GuillaumeGomez, hdhoang, he4d, hilias, HiranmayaGundu, hirschenberger, homburg, iamcodemaker, incrop, ineol, Jacobious52, jankoprowski, JCavallo, jdvr, jerodsanto, JesterOrNot, johnae, johnterickson, jonathandturner, JonnyWalker81, jonstodle, JosephTLyons, jzaefferer, k-brk, Kelli314, klnusbaum, kloun, kornelski, kubouch, kvrhdn, landaire, lesichkovm, LhKipp, lightclient, lincis, lord, luccasmmg, marcelocg, matsuu, mattclarke, mattyhall, max-sixty, mfarberbrodsky, mhmdanas, mike-morr, miller-time, mistydemeo, mlbright, mlh758, morrme, nalshihabi, naufraghi, nespera, neuronull, nickgerace, nmandery, notryanb, oknozor, orf, orientnab, oskarskog, oylenshpeegul, pag4k, Paradiesstaub, philip-peterson, piotrek-szczygiel, pizzafox, pka, pmeredit, pontaoski, Porges, pulpdrew, q-b, quebin31, rabisg0, ramonsnir, rimathia, ritobanrc, rnxpyke, romanlevin, routrohan, rrichardson, rtlechow, rutrum, ryuichi1208, Samboy218, samhedin, sandorex, sdfnz, sebastian-xyz, shaaraddalvi, shiena, siedentop, Sosthene-Guedon, Southclaws, svartalf, taiki-e, Tauheed-Elahee, tchak, thegedge, tim77, Tiwalun, twe4ked, twitu, u5surf, UltraWelfare, uma0317, utam0k, vsoch, vthriller, waldyrious, warrenseine, wycats, yaahc, yahsinhuangtw, yanganto, ymgyt, zombie110year + +# What is Nushell? + +Nushell is an interactive programming language for working with your files, your system, and your data as a shell, a notebook, and more. + +## Nu is more than a shell + +It's easy to think of Nushell as just a shell. It's even got 'shell' in the name. It's the first and probably main way you'll interact with it. So why say it's "more than a shell"? + +In truth, Nushell is actually two things at once: Nu and Nushell. Nu is an interactive language for processing streams of structured data, data that you're probably getting from files, your system, a web address, etc. + +So what's Nushell? + +Nushell is taking the Nu language and putting it into a shell, and building around it a set of shell features to make it feel comfortable to use as a login shell. Completions, pretty error messages, and the like. + +When we say that "Nu is more than a shell", does that imply that Nu can be used in other places, too? Absolutely. We've got two more hosts that let you run Nu, a [jupyter-based](https://github.com/nushell/nu_jupyter) host that lets you run Nu in jupyter notebooks, and a [WebAssembly-based](https://github.com/nushell/demo) host that we use to create the [Nu playground](https://www.nushell.sh/demo/) + +The idea of Nu runs deeper than just the shell, to being a language that's relatively easy to learn, yet powerful enough to do real work with your system, to process large amounts of data, to interactively let you iterate quickly on an idea, to invite exploration by building up a pipeline one piece at a time. There's really no shortage of ambition for where we hope to go. + +# The design of Nu + +Nu's original design has proven surprisingly robust thus far. Some of its core ideas are continuing to pay dividends a year later. Let's look at the designs that still feel right. + +## Pipelines are infinite + +When we first started writing Nu, we took a few shortcuts that had us processing all the data in a pipeline at once. Very quickly, we realize this wasn't going to work. External commands (think `cat /dev/random`) can output an infinite stream of data, and the system needs to be able to handle it. Understanding this, we transitioned to a different model: data flows between command as infinite streams of structured data. As the data is processed, we avoid collecting the data whenever possible to allow this streaming to happen. + +Because the streams can be infinite, even the printing out of tables is done a batch at a time. + +## Separating viewing data from the data itself + +Coming from other shells, the idea of running `echo` or `ls` goes hand-in-hand with printing something to the terminal. It's difficult to see that there two steps going on behind the scenes: creating the information and then displaying it to the screen. + +In Nu, these two steps are distinct. The `echo` command gets data ready to output into stream, but doesn't do any work to print it to the screen. Likewise, `ls` gets ready to output a stream of file and directory entries, but doesn't actually display this information. + +That's because both `echo` and `ls` are lazy commands. They'll only do the work if the data is pulled from the stream. As a result, the step of viewing the data is separate from the step of creating it. + +Behind the scenes, Nu converts a standalone `ls` to be the pipeline `ls | autoview`. The work of viewing comes from `autoview` and it handles working with the data and calling the proper viewer. In this way, we're able to keep things as structured data for as long as possible, and only convert it to be displayed as the final step before being shown to the user. (note: the wasm-based demo and jupyter do a similar step, but instead of adding `autoview`, they add `to html`) + +## Rich data types + +In a similar way to working with structured data, rather than only plain text, Nu takes a different approach to data types as well. Nu takes the traditional set of basic types, like strings and numbers, and extends them into a richer set of basic data primitives. + +Numbers are represented internally as big numbers and big decimals, rather than integers and floating point machine-based representations. This gives us more flexibility to do math more accurately, and generally removes the worry of whether the number you want to work with will fit in the integer or float size you have available. + +We carry this further, by also representing values common in modern computer usage: URLs, file paths, file sizes, durations, and dates are all examples of built-in data types. By building them in, Nu can have better syntax and type checking with their use. + +For example, in Nu it's possible to write `= 1min + 1sec` to create a duration that is one minute one second long. You can also use the file sizes, like being able to filter a directory list by the size of the file `ls | where size > 10kb`. + +Nu also can help if you try to mix types that shouldn't. For example, if you had written: `= 1min + 1kb` it seems you didn't mean to add time and file sizes together, and Nu gives you an error if you do: + +``` +error: Coercion error + ┌─ shell:1:3 + │ +1 │ = 1min + 1kb + │ ^^^^ --- filesize(in bytes) + │ │ + │ duration +``` + +*note: we'll be making this error better in the future* + +Data in Nu also isn't just the value, but it's also a set of metadata that comes with the value. For example, if you load data from a file using the `open` command, we track the place that it's loaded along with the data that's loaded. We can see this metadata using the `tags` command: + +``` +open package.json | tags +───┬─────────────────┬────────────────────────────────────────────────────────────────────────────── + # │ span │ anchor +───┼─────────────────┼────────────────────────────────────────────────────────────────────────────── + 0 │ [row end start] │ /home/jonathan/Source/servo/tests/wpt/web-platform-tests/webrtc/tools/packag + │ │ e.json +───┴─────────────────┴────────────────────────────────────────────────────────────────────────────── +``` + +This extra information allows us to know how to view the contents, and even save you time when you use the `save` command, as it will use the original location by default. + +## Keeping it fun + +Something we attached to early on was the idea that Nu should be fun. It should be fun to work on, it should be fun to contribute to, and it should be fun to use. + +Nu is really about play. You play with your data, you play with the structures that make up your files and filesystem, you play with what web services give back to you. Everything about Nu is made to invite you to explore how things work and how data is put together. As you play, you learn more about Nu works and how to better use it. We firmly believe that learning doesn't have to hurt. At its best, the pleasure of exploration over time yields expertise without punishing you along the way. Humans just get better at something when we love to pick it up day after day, experimenting as we go. With Nu, we can ask questions like "what if I do this?" because the system is built to let us ask the question and answer it ourselves. + +Nu takes this one step further. The error reporting system comes from the design of [Rust's error messages](https://blog.rust-lang.org/2016/08/10/Shape-of-errors-to-come.html), with clear messages to help guide you to success. + +The goal for Nu is that it won't require you to be a wiz with the commandline or with complex programming practices. Instead, you start where you feel comfortable, and grow a line at a time. With Nu, as your comfort grows, single lines easily grow to multiple lines, and (eventually) to larger programs. You don't need separate styles of thinking when experimenting and another for building your application. In Nu, these are (or will be) one and the same. + +## Crossplatform + +One of the first decisions we made in making Nu is that it should not only be cross-platform, but should feel as native as possible across platforms. Commands should work the same, regardless of the platform you're on, without any loss of functionality if you switch from one OS to another. This has meant saying "no" a few times when someone offered to a cool feature, only to find out it didn't work well on one of the supported systems. The benefit, though, is that Nu users can move between OSes comfortably. + +Nu lets you use common shortcuts, too. In Windows, you can change drives using the common `D:` shorthand. You can use `cd ~` and `cd -` as easy shorthands to jump between home and previous directories, too. + +## Getting `$it` right + +Early on, when we were first brainstorming how something like Nushell might work, we rediscovered the idea of iteration having its own special variable. The iteration variable, item variable, or simple the "it" variable, gave us a way to talk about the current row of data flowing through the pipeline. When we can talk about the current row, it was then easier to say how to handle the current row. + +The simplest version is: + +``` +ls | echo $it +``` + +To `echo $it` doesn't really do anything interesting, it just passes along the value it was handed. It's when we combine this with variable paths that things get a little more interesting: + +``` +ls | echo $it.name +``` + +Now, in 4 words we've asked Nu to list all the files in the current directory and output only the names. This pipeline, if there are 100s of thousands of files, will happily stream out its results as it finds new files. As in this case: + +``` +ls **/* | echo $it.name +``` + +Once you have a mental model for using `$it`, it becomes common to grab it when working on data a row at a time. + +A note for those wondering how this works under the hood: if an `$it` is found a part of an argument not otherwise inside of a block, it's "it-expanded". We replace the command with a call to `each` and the block. + +This turns: + +``` +ls | echo $it.name +``` + +Into: + +``` +ls | each { echo $it.name } +``` + +The `each` command handles walking along each row and calling the block each time, setting the variable `$it` to the current row value. + +## Everything is a macro + +In Nu, a command has the form ` `. To the lisp-lovers among you, this should look very familiar. Slap on a pair of parens and you have yourself an s-expression. + +You may be wondering - if you choose a cmd-arg-arg form, how do you write something like: + +``` +where size > 10kb +``` + +This is where Nu's parser steps up. The parser we use is a type-driven, recursive descent parser. If you look at the signature for the `where` command in the Rust code, you'll see it says: + +```rust +Signature::build("where").required( + "condition", + SyntaxShape::Math, + "the condition that must match", +) +``` + +That is, the `where` command takes a single parameter, a `condition`, which has a SyntaxShape of Math. This shape drives the parser to use different parser logic. + +In math mode, we can now parse an expression using operator precedence. The `where` command tells the parser to treat all of the free parameters as a single expression, to parse that expression, and to pass it as the single argument. The canonical form is more precise, though a bit more cumbersome: + +``` +where { = $it.size > 10kb } +``` + +You can also see a few other steps thrown in, like the expansion of a short-hand path into the full variable path using `$it`. + +## Kebabs and question marks + +Being able to use `-` in the names of commands, sometimes called "kebab case", is a handy feature and one we enjoy. In Nu, you can use it whenever you need to pass an identifier. `kebab-case-rules`. + +In addition to kebab case, you can use `?` as part of the identifier, allowing names in a Ruby-style. We use it in the command `empty?`. + +## Code growth + +Nushell currently sits at just over 55k lines of code, built from almost 1300 merged pull requests. + +![image of a Nu growing from under 20000 lines of code to over 55000 lines of code](../assets/images/year_1_kloc.png) + +*Growth in code size with each version* + +# Surprises? + +It's funny, when you start working on a shell it's easy to think "it'll be like a REPL". In fact, it's closer to creating an interactive IDE for the terminal. As people came to Nu from other shells, including shells like fish, there was a strong assumption that completions would be stellar, that it will integrate well with existing workflows, and it will support configuring the prompt, the keybindings, and more. + +It also turns out that getting a shell correct is a lot more experimentation and a lot less following what the textbooks say. In practice, things like 'stdout' and 'stderr' are used in a variety of ways, as are the exit codes output by programs. Our initial designs started with a stricter view of these ideas, and softened over time as we saw that the real world is a much fuzzier place than we realized. + +# Quirks + +Nu hasn't been without a few quirks. Like any awkward growth spurt, we've had our awkward times and still have a few "curious" areas. + +## No variables, yet + +Had you a time machine and told us a year ago that we still wouldn't have variables today, we probably wouldn't have believed you. Isn't that an important part of a language? + +Yes, it's definitely important. But we're also surprised just how far you can get without them. When you think about how you work with a piece of data, maybe you break it apart, maybe you work over the lines, or maybe you search inside of it. Each of these has a built-in way to perform the task in Nu and none require user-defined variables. + +That, of course, has its limits. At some point you want to take the result of one batch of commands and store it for later. We're thinking through how to do this, and it comes down to a few basic questions: + +* Should variables work in a traditional way? That is, should we fully evaluate what we pass to the variable during assignment? +* Or, should Nu instead "hold" the pipeline you use during the assignment, so that you can run it whenever you want the value of the variable (possibly caching the result if possible)? This is less traditional, but more in line with a language that works lazily on potentially endless streams of data. + +There are other questions we still need to answer as well, like how do variables and function definitions play together? How do variables shadow each other (or even if they're allowed)? + +## To view or not to view + +Nushell, being a language focused on working on structured data, has a few quirks with how and when the data is viewed. For one, Nushell has multiple types of data, and different types of data may have different viewing needs. To help with this, we created `autoview`, a command that will look at the data and detect a variety of different cases. Once it's identified the shape of the data, it will call out to the viewing command that handles viewing that particular kind of data. + +Autoview is applied to any of the data being output directly to the user, which is the case for the last step of a pipeline. For example, the pipeline `ls` is actually `ls | autoview` behind the scenes. The `ls` command outputs each row of data corresponding to the files in the directory, creating a table. These rows are passed to `autoview` which detects that we need to view a table, calls the `table` command, which then views the data. This generally feels natural, well, most of the time. + +It makes sense that `ls | where size > 10kb` doesn't output the data that flows between the two commands. If we did, it wouldn't be clear what the actual answer was. But what about in this situation: `ls; echo "done"`? Do we output the result of `ls` or not? + +In the current version of Nu, we don't. We treat anything to the left of `;` as "do this, finish it, but don't run 'autoview'". This let's you do a series of different kinds of processing and only then view the end result. + +This seems reasonable until you see something like `echo "hello"; echo "world"` and only see the output "world" and then have to stop and think through all the steps that led to that output. + +## Getting turned around + +As it turns out, the terminal is small. Want to view a few columns? Generally not a problem. Want to open that random CSV file from work with 30 columns? Well, now we might have a problem. How does that 30 column file actually look when you print it out in the terminal, with a nicely drawn table? + +For some cases, we found we could be helpful by rotating the table so that the columns go along the side instead of the top. This is especially handy when there's only one row of data as it reads more like a record. + +That being said, it's not without its trade-offs. To some folks, rotating the table when they aren't expecting it can be very disorienting. We're still working to figure out the best defaults and heuristics. + +# Future work + +## Focus + +Nushell is in the stage of the project where we're still experimenting with what the language should be, how it works in practice, and finding out what its most important core values are. Rust, the language Nushell is written in, went through a similar stage. As it found its most important values, it tried on others. Once people started to create real projects in Rust, and show what was possible with this core part of the language, the design began to gel and then solidify as it arrived at 1.0. As part of that, early ideas were modified or discarded altogether. + +Nushell will go through a similar stage. As it grows, it will find its sweet spot, its niche that it naturally fills. The design will come from features built to solve real problems, and we'll polish these features, improving their utility, error messages, documentation, and overall flow. The end result will be a sharper, more focused Nushell that feels like the tool you want in your toolbox. Some early adopters are already giving us feedback that Nushell is well on its way of meeting this role, and we're excited to continue to explore and refine as we go. + +## Exploring the data model + +There are some really juicy open questions that we'll work on in the coming year. We already have a fairly rich set of data primitives, like strings, dates, file sizes, durations, and more. Figuring out what makes sense to be built-in vs what should be added from outside of the core Nu data model will take a bit of time and finesse as we get more experience working with Nu in the real world. + +## Shifting to being a full language + +Looking at Nu today, you can see some common parts of languages like `if` or `open`, but it doesn't yet feel like there's enough syntax to build up full programs. You can't define your own commands, your own variables, and you can't build out a project across multiple files. We're working to address all of these limitations so that Nu can function not only for one-liners, but also for much more. + +## Getting completions *really* good + +A regular point of feedback is that people want completions where possible. We've got some ideas here that will allow us to have completions in far more places, including external commands (think `git checkout `). We're laying the groundwork for this now, and looking forward to rolling out more functionality as we go. + +# Conclusion + +We had far more support and made far more progress than we could have ever predicted a year ago. Today's Nu is something many people use as their daily driver, and it gets stronger with each release. We're excited to bring Nu to a broader audience as we continue to improve usability, grow its feature set, and refine its internals. + +If you'd like to try out Nu, you can download it from the [github releases page](https://github.com/nushell/nushell/releases), from [crates.io](https://crates.io/crates/nu), or from the many [other distributions](https://repology.org/project/nushell/versions). + +If you'd like to help us create Nu, please do! You can find us on the [Nushell github](https://github.com/nushell/nushell) and on our [discord server](https://discord.gg/NtAbbGn). If you use Twitter, [come say hi](https://twitter.com/nu_shell), we'd love to chat. diff --git a/blog/2020-09-01-nushell_0_19.md b/blog/2020-09-01-nushell_0_19.md new file mode 100644 index 00000000000..699d128621a --- /dev/null +++ b/blog/2020-09-01-nushell_0_19.md @@ -0,0 +1,162 @@ +--- +title: Nushell 0.19 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.19 of Nu. In this version, we fill some long-lived gaps in Nu, improve completions, theming, and much more. +--- + +# Nushell 0.19 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.19 of Nu. In this version, we fill some long-lived gaps in Nu, improve completions, theming, and much more. + +# Where to get it + +Nu 0.19 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.19.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want all the goodies, you can install `cargo install nu --features=extra`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## New completion engine (thegedge) + +![animation of Nu completion](../assets/images/0_19_autocomplete.gif) + +Nushell's completion suggestions are now built around the nushell parser. This means completers can now use a much richer context to provide relevant suggestions. This is still a work in progress, but one immediate improvement is that we can now complete commands, flags, and arguments in most nested structures. For example, `echo $(l` will show you all commands that start with l. + +The completion work is still very "new", with parts landing in the hours before the release, so please give it a spin and let us know where we can keep improving it. + +## Improved theming (fdncred) + +![image of a Nu table built with hearts](../assets/images/0_19_heart_theme.png) + +_Nu, with love_ + +We're continuing to expand what's possible with Nu's themes, allowing you to configure more areas of how your data is displayed. + +![image of a Nu table custom colors](../assets/images/0_19_table_colors.png) + +You can also configure how the various Nu data types are displayed. You can learn about the [new custom data colors](https://github.com/nushell/nushell/pull/2449) if you're interested in configuring them for yourself. There's also and example `config.toml` [here](https://github.com/nushell/nushell/blob/main/docs/sample_config/config.toml) with an example of how to set the colors you like. + +## Table literals (jonathandturner) + +Starting with 0.19, you can now write table values like you would other kinds of values. To do so, separate a row of header names from the data using a `;`. For example: + +``` +> echo [[name size]; [JT 185] [KJ 160]] +───┬──────┬────── + # │ name │ size +───┼──────┼────── + 0 │ JT │ 185 + 1 │ KJ │ 160 +───┴──────┴────── +``` + +To be a valid table, the number of columns needs to line up. + +## Multiline edits (jonathandturner) + +In addition to the new table literals, we're opening up multiline commands. Initially, this will be for the line editor, but we'll extend this further as we improve parser support. + +You can now also write the above: + +``` +> echo [ +[name, size]; +[JT, 185] +[KJ, 160] +] +───┬──────┬────── + # │ name │ size +───┼──────┼────── + 0 │ JT │ 185 + 1 │ KJ │ 160 +───┴──────┴────── +``` + +You might have noticed we now also allow commas to separate cells. These are intended to help readability and give a more familiar syntax for people coming from other languages. + +## Nushell celebrates its first year in the public + +We recently sat down and wrote about [where Nushell has come over the last year](http://www.nushell.sh/blog/2020/08/23/year_of_nushell.html) and some thoughts about where it's going. The blog post is a wealth of information about Nu's philosophy and direction. Well worth a read. + +## Command improvements + +* `size` now gives back [simpler columns](https://github.com/nushell/nushell/pull/2473) (gillespiecd) +* `uniqe` has [more examples](https://github.com/nushell/nushell/pull/2472) (gillespiecd) +* `ls` will tolerate more [OS errors while listing](https://github.com/nushell/nushell/pull/2466) (gorogoroumaru) +* `cd .` now [does the expected](https://github.com/nushell/nushell/pull/2457) (VincentWo) +* `math stddev` and `math variance` both received updates (gillespiecd) +* List literals can [now have commas](https://github.com/nushell/nushell/pull/2454) (jonathandturner) +* `str index-of` can now do a [reverse find](https://github.com/nushell/nushell/pull/2430) (fdncred) +* A new [PowerShell plugin sample](https://github.com/nushell/nushell/pull/2429) (fdncred) +* New [`path dirname` and `path filestem` subcommands](https://github.com/nushell/nushell/pull/2428) (fdncred) +* The `alias` command now has [optional type inference](https://github.com/nushell/nushell/pull/2418) (bailey-layzer) +* The line editor hinter is [now configurable](https://github.com/nushell/nushell/pull/2405) (amitdev) +* `version` now includes the [git hash when built locally](https://github.com/nushell/nushell/pull/2390) (coolshaurya) +* `touch` can now take [multiple arguments](https://github.com/nushell/nushell/pull/2386) (jzaefferer) +* `date` now has [subcommands](https://github.com/nushell/nushell/pull/2383) (gorogoroumaru) +* A new [`sleep` command](https://github.com/nushell/nushell/pull/2381) (LhKipp) +* Improvements to `ls` and [hidden files](https://github.com/nushell/nushell/pull/2379) (mattclarke) +* `sort-by` errors [now point to mismatched types](https://github.com/nushell/nushell/pull/2366) (luccasmmg) +* `str` subcommands for [various capitalizations](https://github.com/nushell/nushell/pull/2360) (rrichardson) +* Time units are now [more readable](https://github.com/nushell/nushell/pull/2356) (mattclarke) +* Exit scripts from per-directory environments are now [run in the original directory](https://github.com/nushell/nushell/pull/2352) (samhedin) +* We've also got a [Portuguese translation of the contributor book(!!)](https://github.com/nushell/contributor-book/pull/29) (vpperego) +* Improved [RHEL installation instructions](https://github.com/nushell/book/pull/126) (arnaldo2792) + +## More cleanup and improvements (gillespiecd, jonathandturner, Marcoleni, andrasio, dmeijboom, thegedge, jzaefferer, ryuichi1208, JosephTLyons) + +Cleanups in math commands, extra bits of command help, reformating of the command list, better email samples, cleaned up spans in pipelines, fix to `header` command with mismatched columns, cleanup of dependency usage, cleaned up display config, added crossreferences in command help, subcommands are now sorted before being listed, some dockerfile improvements, nu-cli now has nu-data split off from it, column count now won't break on empty tables, wasm is now tested on CI, improvements to `histogram` and `count`, + +## Breaking changes + +### Starship is now external + +To help Nu focus a bit more on the core capabilities, and to free up it to update separate from Nu, Starship is now external. Once you install Starship, you can set your prompt to use starship using: + +``` +> config set prompt `echo $(starship prompt)` +``` + +You can also set Nu to use other prompts as well. For example, if you like powerline, you can also use this: + +``` +> config set prompt `echo $(powerline shell left)` +``` + +### No more auto-pivot by default + +Based on feedback from users, we've now disabled any auto-pivoting of tables by default. You can still re-enable this behavior in your config, but we will no longer rotate any tables without being explicitly asked. + +``` +# To only rotate large tables: +> config set pivot_mode auto + +# To always rotate a single row to be vertical: +> config set pivot_mode always +``` + +### Time units are now renamed + +To make it easier, and more readable, to work with a variety of units in the future, we've renamed the time units. + +Instead of `1s`, you'll now use `1sec`. Most units for time now follow 3 letters instead of a single letter. You can read more about the [full change in the PR](https://github.com/nushell/nushell/pull/2356). + +### Header colors + +With the new theming support, `header_color`, `header_bold`, and `header_align` have moved into the `[color_config]` section, and out of the root level, of the `config.toml` file. + +### Simplified default build + +While not technically a breaking change, it's worth a mention that starting with 0.19, you don't need to use `--features=stable` to get most of Nu's features. We've folded most of the common ones into the default install. For all the bells and whistles, now use `--features=extra`, which includes additional functionality not part of the original `stable` release. + +# Looking forward + +With 0.19, we see the first deeper changes to the completion engine since Nu was first released. These will grow to allow custom completions for commands, and we're looking forward to making these features available. + +The new table literal also takes a step in the direction of data frame support in the future, a powerful feature popularized by pandas, R and other data processing libraries and languages. With it, we hope Nu will continue to grow to having a richer, more nuanced, view of data over time. diff --git a/blog/2020-09-22-nushell_0_20.md b/blog/2020-09-22-nushell_0_20.md new file mode 100644 index 00000000000..2391ceac8b6 --- /dev/null +++ b/blog/2020-09-22-nushell_0_20.md @@ -0,0 +1,133 @@ +--- +title: Nushell 0.20 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.20 of Nu. In this version, we're introducing some new features for working with rows, improvements to completions, and more. +--- + +# Nushell 0.20 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.20 of Nu. In this version, we're introducing some new features for working with rows, improvements to completions, and more. + +# Where to get it + +Nu 0.20 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.20.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want all the goodies, you can install `cargo install nu --features=extra`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## New functionality + +### `each group` and `each window` (ritobanrc) + +With 0.20, you can now work with groups of rows at a time easier than ever before. + +For example, let's say you have a table like this: + +``` +───┬───────┬───── + # │ name │ age +───┼───────┼───── + 0 │ Joe │ 30 + 1 │ Fred │ 40 + 2 │ Sally │ 40 + 3 │ Sean │ 42 + 4 │ Gram │ 66 + 5 │ Todd │ 1 +───┴───────┴───── +``` + +And you wanted to take three rows at a time, and sum the ages. You can now do this using: + +``` +... | each group 3 { get age | math sum } +───┬───── + 0 │ 110 + 1 │ 109 +───┴───── +``` + +Or, you can slide a "window" over the data, looking at multiple rows at a time. Let's slide a window of two rows, so that we look at each pair. We can use this to average the adjacent rows: + +``` +... | each window 2 { get age | math avg } +───┬───────── + 0 │ 35.0000 + 1 │ 40.0000 + 2 │ 41.0000 + 3 │ 54.0000 + 4 │ 33.5000 +───┴───────── +``` + +### Completion improvements (thegedge, rezural) + +The new completer received a [lot of bugfixes](https://github.com/nushell/nushell/pull/2497), [more fixes](https://github.com/nushell/nushell/pull/2503), and [yet more fixes](https://github.com/nushell/nushell/pull/2525) since its initial release with 0.19. We're continuing to improve this experience further. + +Completions can [now be case-insensitive](https://github.com/nushell/nushell/pull/2556). This is especially useful for platforms where filepaths are case-insensitive. + +## Command Improvements + +* **NEW** [`random integer`](https://github.com/nushell/nushell/pull/2489) - create random integers (smaydew) +* **NEW** [`exec`](https://github.com/nushell/nushell/pull/2495) - on Unix-based systems with exec support, you can now call the built-in `exec` command (almindor) +* **NEW** [`mod`](https://github.com/nushell/nushell/pull/2505) - a new modulo operator (jonathandturner) + +* `mv` now uses the [`fs_extra` crate for better recursive moves](https://github.com/nushell/nushell/pull/2487) (almindor) +* More table themes (fdncred) +* `ls -l` now also lists the [number of links](https://github.com/nushell/nushell/pull/2496) (gillespiecd) +* `str substring` can now [optionally take a range](https://github.com/nushell/nushell/pull/2499) (defstryker) +* `char` gets support for [weather characters](https://github.com/nushell/nushell/pull/2500) (fdncred) +* Ranges can now [start or end with variables](https://github.com/nushell/nushell/pull/2506) and can have [decimal numbers as boundaries](https://github.com/nushell/nushell/pull/2509) (jonathandturner) +* Ranges can now [also be exclusive](https://github.com/nushell/nushell/pull/2541) using the `x..`. + +# What's New + +## New functionality + +### Charting (andrasio) + +![animation of building different types of bar charts](../assets/images/0_21_bar_charts.gif) + +_New charting functionality_ + +Nushell now supports bar and line charts for when you want to quickly take a look at data you're exploring. You can reach these through the new `chart` command. + +Here's an example of using `chart` to chart out contributions to a git repository: + +``` +> git log "--pretty=format:%h%aN%s%aD" | lines | split column "" sha1 author desc merged_at | where author == "Andrés N. Robalino" | update merged_at { get merged_at | str to-datetime } | reverse | chart line merged_at -f "%b-%Y" +``` + +![line chart of github contributions](../assets/images/0_21_line_chart.png) + +_Line chart of GitHub contributions_ + +### Improvements + +* `rm -f` no longer complains if the path can't be found (luccasmg) +* `benchmark` now randomizes the environment for more accurate results (tumdum) +* `select` now works with columns that have spaces (JonathanArns) +* math with duration now properly handles overflow (samualvanderwaal) +* `mv` now properly fails if you try to move a directory into itself (luccasmg) +* smarter auto-conversion to string where possible, helping with commands like `clip` (gillespiecd) +* added left and right padding for strings via `str lpad` and `str rpad` (fdncred) +* blink and strikethrough added to colors (fdncred) +* initial WASI support (jonathandturner) +* inf/nan handled in CSV (gillespiecd) +* new `xpath` command that can search XML documents (fdncred, andrasio) +* rustyline paste mode no longer assumes bracketed paste (wcarss) + +### Internal improvements (fdncred, gillespiecd, jonathandturner, JosephTLyons, andrasio) + +Windows builds now use a bigger stack, suggestions have been cleaned up, cleaned up unused files in nu-data, some redundant dependencies were simplified, variable scope was improved to make way for variables, internal names for `describe` have been improved, nu-protocol got a tidy, added example to `update`, fix for panics in `str to-datetime`, internal name of `to md` corrected, `empty?` got a rewrite, integers are now parsed as BigInt, decimals are now parsed as BigDecimal, cleanup of old files in the root, more tests added, + +# Looking forward + +We recently finished the Nushell survey and will be working on processing the results, which will help us plan the next few months. Also, if you haven't heard, Nushell is part of the [new Couchbase CLI experience](http://couchbase.sh). There are also lots of big plans for improving core parts of the system, including line editing, completions, and more. If you're interested in helping out, come chat with us on [discord](https://discord.gg/NtAbbGn). \ No newline at end of file diff --git a/blog/2020-11-03-nushell_0_22.md b/blog/2020-11-03-nushell_0_22.md new file mode 100644 index 00000000000..28bd7a80277 --- /dev/null +++ b/blog/2020-11-03-nushell_0_22.md @@ -0,0 +1,120 @@ +--- +title: Nushell 0.22 +author: The Nu Authors +author_site: https://twitter.com/nu_shell +author_image: https://www.nushell.sh/blog/images/nu_logo.png +excerpt: Today, we're releasing 0.22 of Nu. In this version, we introduce a charting functionality for quickly exploring data, stability improvements, and some general command cleanups. +--- + +# Nushell 0.22 + +Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines. + +Today, we're releasing 0.22 of Nu. In this version, we introduce a charting functionality for quickly exploring data, stability improvements, and some general command cleanups. + + + +# Where to get it + +Nu 0.22 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.22.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`. + +If you want all the goodies, you can install `cargo install nu --features=extra`. + +As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_`. + +# What's New + +## New functionality + +### The `flatten` command (andrasio) + +![animation of using the flatten command](../assets/images/0_22_flatten.gif) + +_New flatten command_ + +There's now a flatten command that can take tables nested inside of the main table and flatten their contents into the main table. + +### More `math` commands (morbatex, gillespiecd, fdncred) + +You can now use rounding in math operations: + +``` +> echo [1.5 2.3 -3.1] | math ceil +───┬──── + 0 │ 2 + 1 │ 3 + 2 │ -3 +───┴──── + +> echo [1.5 2.3 -3.1] | math floor +───┬──── + 0 │ 1 + 1 │ 2 + 2 │ -4 +───┴──── + +> echo [1.5 2.3 -3.1] | math round +───┬──── + 0 │ 2 + 1 │ 2 + 2 │ -3 +───┴──── +``` + +## Breaking changes + +### Remove it-expansion (jonathandturner) + +Previously, we treated the `$it` variable as a special variable that caused a command to iterate over each element in the row, for example `ls | echo $it.name` would expand to `ls | each { echo $it.name }`. + +While this was handy in small examples, in the general case it became confusing to remember when and how it-expansion would happen. + +In this release, we're trying an experiment of removing it-expansion. + +Previously: + +``` +ls | echo $it.name +``` + +Now: + +``` +ls | each { echo $it.name } +``` + +Or, you can switch to other forms, like: + +``` +ls | get name +``` + +We're working towards a simpler mental model, where blocks can have parameters, and `$it` is the name of the parameter if it's not specified. + +Please try it out and let us know what you think. + +## Improvements + +* **New** - a `seq` command for working with sequences (fdncred) +* bson and sqlite support added to the WiX (fdncred) +* `to md` now has a pretty flag (JosephTLyons) +* `ls` can now support other number formatting (lucassmmg) +* Filesize formats can now be changed via `config` (fdncred) +* Tables can now have heavy or no borders (fdncred) +* `math eval` now supports tau (rjboas) +* `char` now has simpler weather emoji (gillespiecd, fdncred) +* `str to-int` now takes an optional radix for conversion (gillespiecd) +* `char` can now print any unicode character (fdncred) +* `alias` now has optional type inference based on the recently accepted RFC (LhKipp) +* `ls` will also list inode in `-l` mode on Unix (gillespiecd) + + +## Internal improvements (andrasio, jonathandturner, LhKipp, EverlastingBugstopper, JosephTLyons, fdncred, jjshanks) + +It's now easier to create column-paths inside of the Nu source, `alias` got some bugfixes, the parser got some bugfixes, fixed typo in the build message, filesize labels for bytes wasn't showing up (now fixed), internally there are now more helpers for creating the core Value type, bumped the required Rust version, bugfix for `;` endings, and remove unneeded comments. + +# Looking forward + +We're continuing to work to simplify the internal representation, improve the parser, and work to add support for features like block parameters, variables, and, in the future, custom commands. + +If you'd like to help out, come by the [discord](https://discord.gg/NtAbbGn) and say hello! \ No newline at end of file diff --git a/blog/README.md b/blog/README.md new file mode 100644 index 00000000000..3f8df96327b --- /dev/null +++ b/blog/README.md @@ -0,0 +1,3 @@ +# Nu Blog + + \ No newline at end of file diff --git a/book/README.md b/book/README.md new file mode 100644 index 00000000000..486302fff15 --- /dev/null +++ b/book/README.md @@ -0,0 +1,23 @@ +# Table of Contents + +* [Installation](installation.md) - Installing nushell +* [Introduction](introduction.md) - Getting started +* [Moving around](moving_around.md) - Moving around in nushell +* [Types of data](types_of_data.md) - Types of data in nushell +* [Loading data](loading_data.md) - Loading data and using it +* [Working with tables](working_with_tables.md) - Working with nushell tables +* [Pipeline](pipeline.md) - How the pipeline works +* [Configuration](configuration.md) - How to configure nushell +* [Aliases](aliases.md) - Added aliases for blocks of commands +* [Math](math.md) - Math operations in nushell +* [Environment](environment.md) - Working with environment variables +* [Metadata](metadata.md) - An explanation of nushell's metadata system +* [Shells](shells_in_shells.md) - Working with multiple locations +* [Escaping commands](escaping.md) - Escaping to native commands of the same name +* [Plugins](plugins.md) - Enhancing nushell with more features using plugins +* [Coming from Bash](coming_from_bash.md) - Guide for those coming to nushell from bash +* [Coming from bash](coming_from_bash.md) - Guide for those coming to nushell from bash +* [NuShell map from shells/DSL](nushell_map.md) - A guide to help understand how nushell compares with SQL, Linq, PowerShell and Bash. Contributions welcome. +* [NuShell map from imperative languages](nushell_map_imperative.md) - A guide to help understand how nushell compares with Python, Kotlin, C++, C# and Rust. Contributions welcome. +* [NuShell map from functional languages](nushell_map_functional.md) - A guide to help understand how nushell compares with Clojure, Tablecloth (Ocaml / Elm) and Haskell. Contributions welcome. +* [NuShell operator map](nushell_operator_map.md) - A guide to help understand operators. \ No newline at end of file diff --git a/book/aliases.md b/book/aliases.md new file mode 100644 index 00000000000..cdca148b031 --- /dev/null +++ b/book/aliases.md @@ -0,0 +1,50 @@ +# Aliases + +Nu's ability to compose long pipelines allow you a lot of control over your data and system, but it comes at the price of a lot of typing. Ideally, you'd be able to save your well-crafted pipelines to use again and again. + +This is where aliases come in. + +An alias allows you to create a short name for a block of commands. When the alias is run, it's like you typed that block of commands out. + +Example: + +``` +> alias ls-names [] { ls | select name } +> ls-names +────┬──────────────────── + # │ name +────┼──────────────────── + 0 │ 404.html + 1 │ CONTRIBUTING.md + 2 │ Gemfile + 3 │ Gemfile.lock + 4 │ LICENSE +``` + +## Parameters + +Aliases can also take optional parameters that are passed to the block. Each of these becomes a new variable in the block. + +``` +> alias e [msg] { echo $msg } +> e "hello world" +hello world +``` + +You can have an arbitrary number of these arguments. When the user doesn't provide a value, the variable in the block will evaluate to Nothing and be removed. + +## Persisting + +By default, aliases only apply to the current session. That can be useful for a temporary helper or testing a new alias, but for aliases to be really useful, they need to be persisted. To do so, call the alias with the `--save` flag (or the `-s` shorthand). For example: + +``` +alias e --save [msg] { echo $msg } +``` + +Aliases are stored in the startup config, which you can look at with `config get startup`. If you get an error, the `startup` config doesn't yet exist. + +You can also edit aliases directly in the config.toml file, for example using `vi`: + +``` +config path | vi $it +``` diff --git a/book/coming_from_bash.md b/book/coming_from_bash.md new file mode 100644 index 00000000000..18eada406a5 --- /dev/null +++ b/book/coming_from_bash.md @@ -0,0 +1,44 @@ +# Coming from Bash + +Note: this table assumes Nu 0.14.1 or later. + +| Bash | Nu | Task | +| ------------- | ------------- | ----- | +| `ls` | `ls` | Lists the files in the current directory | +| `ls ` | `ls `| Lists the files in the given directory | +| `ls pattern*` | `ls pattern*` | Lists files that match a given pattern | +| `ls -la` | `ls --full` or `ls -f` | List files with all available information | +| `ls -d */` | `ls | where type == Dir` | List directories | +| `find . -name *.rs` | `ls **/*.rs` | Find recursively all files that match a given pattern | +| `cd ` | `cd ` | Change to the given directory | +| `cd` | `cd` | Change to the home directory | +| `mkdir ` | `mkdir ` | Creates the given path | +| `mkdir -p ` | `mkdir ` | Creates the given path, creating parents as necessary | +| `touch test.txt` | `touch test.txt` | Create a file | +| `> ` | `| save --raw ` | Save string into a file | +| `cat ` | `open --raw ` | Display the contents of the given file | +| | `open ` | Read a file as structured data | +| `mv ` | `mv ` | Move file to new location | +| `cp ` | `cp ` | Copy file to new location | +| `cp -r ` | `cp -r ` | Copy directory to a new location, recursively | +| `rm ` | `rm ` | Remove the given file | +| | `rm -t ` | Move the given file to the system trash | +| `rm -rf ` | `rm -r ` | Recursively removes the given path | +| `chmod` | `` | Changes the file attributes | +| `date -d ` | `echo | str to-datetime -f ` | Parse a date ([format documentation](https://docs.rs/chrono/0.4.15/chrono/format/strftime/index.html)) | +| `man ` | `help ` | Get the help for a given command | +| | `help commands` | List all available commands | +| `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 $PATH` | `echo $nu.path` | See the current path | +| `` | `config set path [ ...]` | Update PATH permanently | +| `export PATH = $PATH:/usr/other/bin` | `` | Update PATH temporarily | +| `export` | `echo $nu.env` | List the current environment variables | +| `` | `echo $nu.env | insert var value | config set_into env` | Update environment variables permanently | +| `FOO=BAR ./bin` | `FOO=BAR ./bin` | Update environment temporarily | +| `alias s="git status -sb"` | `alias s [] { git status -sb }` | Define an alias temporarily | +| `` | `alias --save myecho [msg] { echo Hello $msg }` | Define an alias for all sessions (persist it in startup config) | +| `` | `` | Add and edit alias permanently (for new shells), find path for the file with `config path` | +| `bash -c ` | `nu -c ` | Run a pipeline of commands (requires 0.9.1 or later) | +| `bash