Skip to content

Commit 4c23c37

Browse files
committed
Merge branch 'main' into sys
2 parents 59bfe40 + ec5939c commit 4c23c37

File tree

191 files changed

+8183
-1857
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+8183
-1857
lines changed

.vuepress/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default defineUserConfig({
7676
title: 'Nushell',
7777
description: 'Um novo tipo de shell.',
7878
},
79-
'/ru': {
79+
'/ru/': {
8080
lang: 'ru-RU',
8181
title: 'Nushell',
8282
description: 'Новый тип оболочки.',

.vuepress/configs/sidebar/en.ts

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,96 @@ export const sidebarEn: SidebarConfig = {
157157
text: 'Language Reference Guide',
158158
link: '/lang-guide/README.md',
159159
collapsible: false,
160-
children: ['/lang-guide/README.md', '/lang-guide/lang-guide.md'],
160+
children: [
161+
'/lang-guide/README.md',
162+
{
163+
text: 'Types in the Nu Language',
164+
link: '/lang-guide/chapters/types/00_types_overview.md',
165+
collapsible: true,
166+
children: [
167+
{
168+
text: 'Basic Types',
169+
link: '/lang-guide/chapters/types/basic_types/00_basic_types.md',
170+
collapsible: true,
171+
children: [
172+
'/lang-guide/chapters/types/basic_types/any.md',
173+
'/lang-guide/chapters/types/basic_types/bool.md',
174+
'/lang-guide/chapters/types/basic_types/int.md',
175+
'/lang-guide/chapters/types/basic_types/float.md',
176+
'/lang-guide/chapters/types/basic_types/filesize.md',
177+
'/lang-guide/chapters/types/basic_types/duration.md',
178+
'/lang-guide/chapters/types/basic_types/date.md',
179+
'/lang-guide/chapters/types/basic_types/range.md',
180+
'/lang-guide/chapters/types/basic_types/string.md',
181+
'/lang-guide/chapters/types/basic_types/record.md',
182+
'/lang-guide/chapters/types/basic_types/list.md',
183+
'/lang-guide/chapters/types/basic_types/table.md',
184+
'/lang-guide/chapters/types/basic_types/closure.md',
185+
'/lang-guide/chapters/types/basic_types/nothing.md',
186+
'/lang-guide/chapters/types/basic_types/binary.md',
187+
'/lang-guide/chapters/types/basic_types/glob.md',
188+
'/lang-guide/chapters/types/basic_types/cellpath.md',
189+
],
190+
},
191+
{
192+
text: 'Other Data Types',
193+
collapsible: true,
194+
children: [
195+
{
196+
text: 'Types that cannot be used to declare variables',
197+
link: '/lang-guide/chapters/types/other_types/00_not_assignable.md',
198+
children: ['/lang-guide/chapters/types/other_types/path.md'],
199+
},
200+
{
201+
text: 'Types which are not declarable',
202+
link: '/lang-guide/chapters/types/other_types/01_not_declarable.md',
203+
children: [
204+
'/lang-guide/chapters/types/other_types/lazy_record.md',
205+
'/lang-guide/chapters/types/other_types/error.md',
206+
'/lang-guide/chapters/types/other_types/custom_value.md',
207+
'/lang-guide/chapters/types/other_types/block.md',
208+
],
209+
},
210+
],
211+
},
212+
'/lang-guide/chapters/types/type_signatures.md',
213+
'/lang-guide/chapters/types/related_commands.md',
214+
],
215+
},
216+
'/lang-guide/chapters/operators.md',
217+
{
218+
text: 'Flow control',
219+
link: '/lang-guide/chapters/flow_control/00_flow_control_overview.md',
220+
collapsible: true,
221+
children: [
222+
'/lang-guide/chapters/flow_control/if-else.md',
223+
'/lang-guide/chapters/flow_control/loop.md',
224+
'/lang-guide/chapters/flow_control/while.md',
225+
'/lang-guide/chapters/flow_control/match.md',
226+
'/lang-guide/chapters/flow_control/try-catch.md',
227+
'/lang-guide/chapters/flow_control/break.md',
228+
'/lang-guide/chapters/flow_control/return.md',
229+
'/lang-guide/chapters/flow_control/continue.md',
230+
],
231+
},
232+
{
233+
text: 'Filters',
234+
link: '/lang-guide/chapters/filters/00_filters_overview.md',
235+
collapsible: true,
236+
children: [
237+
'/lang-guide/chapters/filters/each-par-each.md',
238+
'/lang-guide/chapters/filters/selecting_data.md',
239+
'/lang-guide/chapters/filters/where-filter.md',
240+
'/lang-guide/chapters/filters/select-get.md',
241+
],
242+
},
243+
'/lang-guide/chapters/custom_commands.md',
244+
'/lang-guide/chapters/declarations.md',
245+
'/lang-guide/chapters/variable_scope.md',
246+
'/lang-guide/chapters/strings_and_text.md',
247+
'/lang-guide/chapters/helpers_and_debugging.md',
248+
'/lang-guide/chapters/pipelines.md',
249+
],
161250
},
162251
],
163252
};

assets/images/nushell_hacks_01.png

172 KB
Loading

blog/2024-04-09-art-contest-summary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Art Contest Summary
22

3-
Some time ago, we announced Nushell [logo and mascot contest](2023-12-21-logo-contest.md). We (the core team) agreed that we were not ready to commit to any of the submitted designs and begin using them as our official logo. Nevertherless, since the submissions are great, we wanted to collect and showcase them as a shoutout to the talented contributors.
3+
Some time ago, we announced Nushell [logo and mascot contest](2023-12-21-logo-contest.md). We (the core team) agreed that we were not ready to commit to any of the submitted designs and begin using them as our official logo. Nevertheless, since the submissions are great, we wanted to collect and showcase them as a shoutout to the talented contributors.
44

55
_(The ordering of authors was generated via `[ JLi JustinGarrison aboutscientific ulitroyo ] | shuffle`)._
66

blog/2024-05-15-bashisms.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: Nushell Bashisms
3+
author: The Nu Authors
4+
author_site: https://twitter.com/nu_shell
5+
author_image: https://www.nushell.sh/blog/images/nu_logo.png
6+
excerpt: These are the "bashisms" that Nushell supports.
7+
---
8+
9+
# Bashisms
10+
11+
A frequently asked question is, "What bashims does Nushell support?". Frequently these questions revolve around bang bang functionality.
12+
13+
## What is a bashism
14+
15+
A bashism is a command, operator, or syntax in the repl that most people associate with bash.
16+
17+
## What bashisms does Nushell support?
18+
19+
### Bang Bang syntax
20+
21+
In reedline we support these bashisms.
22+
23+
1. `!!` - Repeat the last command.
24+
2. `!n` - Repeat the nth command from your nushell history.
25+
3. `!-n` - Repeat the nth command from your last history entry.
26+
4. `!$` - Get the last spatially separated token from the last command in your history.
27+
5. `!term` - Repeat the last command match a strings beginning.
28+
29+
#### How to invoke bang bang syntax
30+
31+
In nushell when you type a bang command, it performs that functionality and places the result in the nushell command line buffer in the repl. It does not execute it.

blog/2024-05-15-top-nushell-hacks.md

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
title: Top 5 Nushell Hacks
3+
author: The Nu Authors
4+
author_site: https://twitter.com/nu_shell
5+
author_image: https://www.nushell.sh/blog/images/nu_logo.png
6+
excerpt: Here are the top 5 nushell hacks.
7+
---
8+
9+
# Nushell Hacks
10+
11+
Listed below are the top nushell hacks that people often forget about or didn't know.
12+
13+
## 1. ends-with / starts-with operators
14+
```nushell
15+
❯ ls | where name ends-with .toml or name starts-with Car
16+
╭─#─┬────────name─────────┬─type─┬───size───┬────modified────╮
17+
│ 0 │ Cargo.lock │ file │ 165.4 KB │ 22 minutes ago │
18+
│ 1 │ Cargo.toml │ file │ 6.4 KB │ an hour ago │
19+
│ 2 │ Cross.toml │ file │ 666 B │ an hour ago │
20+
│ 3 │ rust-toolchain.toml │ file │ 1.1 KB │ an hour ago │
21+
╰───┴─────────────────────┴──────┴──────────┴────────────────╯
22+
```
23+
24+
## 2. easter egg
25+
26+
Did you know that when you start nushell, the `$env.CMD_DURATION_MS` value of 0823 is an easter egg? [It's nushell's first public release date month day](https://github.com/nushell/nushell/releases/tag/0.2.0).
27+
28+
## 3. abbr
29+
30+
With this menu and keybinding configured appropriately in your config.nu file, you can hit `ctrl+space` and your alias abbreviation will expand to it's non-abbreviated form.
31+
32+
For instance, if you have this alias
33+
```nushell
34+
alias gwch = git whatchanged -p --abbrev-commit --pretty=medium
35+
```
36+
and then you type `gwch<ctrl+space>` it will expand on the prompt line to
37+
```nushell
38+
git whatchanged -p --abbrev-commit --pretty=medium
39+
```
40+
41+
### keybinding
42+
```js
43+
{
44+
name: abbr
45+
modifier: control
46+
keycode: space
47+
mode: [emacs, vi_normal, vi_insert]
48+
event: [
49+
{ send: menu name: abbr_menu }
50+
{ edit: insertchar, value: ' '}
51+
]
52+
}
53+
```
54+
### menu
55+
```js
56+
{
57+
name: abbr_menu
58+
only_buffer_difference: false
59+
marker: "👀 "
60+
type: {
61+
layout: columnar
62+
columns: 1
63+
col_width: 20
64+
col_padding: 2
65+
}
66+
style: {
67+
text: green
68+
selected_text: green_reverse
69+
description_text: yellow
70+
}
71+
source: { |buffer, position|
72+
scope aliases
73+
| where name == $buffer
74+
| each { |it| {value: $it.expansion }}
75+
}
76+
}
77+
```
78+
## 4. case-insensitive `where` with `ls`
79+
80+
People often forget that the `=~` and `!~` are regular expression operators, which means you can do a case-insensitive search like this.
81+
82+
```nushell
83+
❯ ls | where name =~ '(?i)car'
84+
╭─#─┬────name────┬─type─┬───size───┬────modified────╮
85+
│ 0 │ Cargo.lock │ file │ 160.6 KB │ 8 hours ago │
86+
│ 1 │ Cargo.toml │ file │ 6.4 KB │ 8 hours ago │
87+
│ 2 │ car.txt │ file │ 0 B │ 11 seconds ago │
88+
╰───┴────────────┴──────┴──────────┴────────────────╯
89+
```
90+
91+
## 5. the magic of nushell datatype closures
92+
93+
In your config.nu file you can have themes that color nushell datatypes a particular color. One thing that is sometimes overlooked is that these colors can also be closures, like the one below for `string`.
94+
95+
```nushell
96+
string: {|| if $in =~ '^#[a-fA-F\d]+' { $in } else { 'default' } }
97+
```
98+
99+
This allows nushell to detect anything that looks like a hex color and display that color in nushell.
100+
101+
This allows you to take a file like the x11 rgb.txt file and parse it into colors.
102+
103+
rgb.txt
104+
```nushell
105+
❯ open ~/Downloads/rgb.txt | lines | last 10
106+
╭───┬───────────────────────────────────╮
107+
│ 0 │ 139 0 0 DarkRed │
108+
│ 1 │ 144 238 144 light green │
109+
│ 2 │ 144 238 144 LightGreen │
110+
│ 3 │ 220 20 60 crimson │
111+
│ 4 │ 75 0 130 indigo │
112+
│ 5 │ 128 128 0 olive │
113+
│ 6 │ 102 51 153 rebecca purple │
114+
│ 7 │ 102 51 153 RebeccaPurple │
115+
│ 8 │ 192 192 192 silver │
116+
│ 9 │ 0 128 128 teal │
117+
╰───┴───────────────────────────────────╯
118+
```
119+
And after parsing the file looks similar to this.
120+
![rgb](../assets/images/nushell_hacks_01.png)

0 commit comments

Comments
 (0)