Skip to content

Commit fb05320

Browse files
authored
Merge pull request #33 from nushell-prophet/dev
numd 0.1.5 - let's add some beauty
2 parents 1115472 + e70ee75 commit fb05320

File tree

18 files changed

+1998
-578
lines changed

18 files changed

+1998
-578
lines changed

README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use numd
3333
numd run --help
3434
```
3535
```output-numd
36-
run nushell code chunks in a markdown file, outputs results back to the `.md` and optionally to terminal
36+
run nushell code chunks in a markdown file, output results back to the `.md` and optionally to terminal
3737
3838
Usage:
3939
> run {flags} <file>
@@ -45,9 +45,10 @@ Flags:
4545
--no-save - do not save changes to the `.md` file
4646
--no-info - do not output stats of changes in `.md` file
4747
--intermid-script <Filepath> - optional a path for an intermediate script (useful for debugging purposes)
48-
--no-fail-on-error - skip errors (and don't update markdown anyway)
48+
--no-fail-on-error - skip errors (and don't update markdown in case of errors anyway)
4949
--prepend-intermid <String> - prepend text (code) into the intermid script, useful for customizing nushell output settings
5050
--diff - use diff for printing changes
51+
--width <Int> - set the `table --width` option value
5152
-h, --help - Display the help message for this command
5253
5354
Parameters:
@@ -90,10 +91,10 @@ numd run examples/1_simple_markdown/simple_markdown_with_no_output.md --no-save
9091
╭────────────────┬───────────────────────────────────╮
9192
│ filename │ simple_markdown_with_no_output.md │
9293
│ nu_code_blocks │ 3 │
93-
│ levenstein │ 38
94-
diff-lines │ +5 (20%) │
95-
diff-words │ +7 (9.6%)
96-
diff-chars │ +38 (8.8%)
94+
│ levenstein │ 40
95+
diff_lines │ +6 (25%) │
96+
diff_words │ +7 (12.5%)
97+
diff_chars │ +40 (11.7%)
9798
╰────────────────┴───────────────────────────────────╯
9899
```
99100

@@ -103,7 +104,7 @@ Also `--diff` param can be used to display diff of changes.
103104
numd run examples/1_simple_markdown/simple_markdown_with_no_output.md --diff --no-save --no-info
104105
```
105106
```output-numd
106-
// ls; # mind that this ls won't print in the markdown as it is used without `echo` or `>`
107+
// # This chunk will produce some output in a separate block
107108
// $var1 | path join 'baz' 'bar'
108109
// ```
109110
// + ```output-numd
@@ -116,6 +117,7 @@ numd run examples/1_simple_markdown/simple_markdown_with_no_output.md --diff --n
116117
// # This chunk will output results inline
117118
// > whoami
118119
// + user
120+
// +
119121
// > 2 + 2
120122
// + 4
121123
// ```
@@ -156,9 +158,10 @@ Input/output types:
156158
start capturing commands and their results into a file
157159
158160
Usage:
159-
> start (file)
161+
> start {flags} (file)
160162
161163
Flags:
164+
--separte - don't use `>` notation, create separate chunks for each pipeline
162165
-h, --help - Display the help message for this command
163166
164167
Parameters:
@@ -195,14 +198,17 @@ Input/output types:
195198
│ examples/2_numd_commands_explanations │ dir │
196199
│ examples/3_book_types_of_data │ dir │
197200
│ examples/4_book_working_with_lists │ dir │
201+
│ examples/5_dataframes │ dir │
198202
╰─────────────────name──────────────────┴─type─╯
199203
200-
> sys | get host.boot_time
201-
2024-04-07T05:26:21+00:00
204+
> sys host | get boot_time
205+
Fri, 24 May 2024 07:47:14 +0000 (2 weeks ago)
206+
202207
> 2 + 2
203208
4
209+
204210
> git tag | lines | sort -n | last
205-
0.1.1
211+
0.1.4
206212
```
207213

208214
## Real fight examples to try

examples/1_simple_markdown/simple_markdown.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ let $var1 = 'foo'
1111
## Example 2
1212

1313
```nu
14-
# This chunk will produce some output in the separate block
15-
ls; # mind that this ls won't print in the markdown as it is used without `echo` or `>`
14+
# This chunk will produce some output in a separate block
1615
$var1 | path join 'baz' 'bar'
1716
```
1817
```output-numd
@@ -25,6 +24,7 @@ foo/baz/bar
2524
# This chunk will output results inline
2625
> whoami
2726
user
27+
2828
> 2 + 2
2929
4
3030
```

examples/1_simple_markdown/simple_markdown.md_intermid.nu

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,39 @@
22
# https://github.com/nushell-prophet/numd
33
cd /Users/user/git/numd
44
const init_numd_pwd_const = '/Users/user/git/numd'
5-
print "###code-block-starting-line-in-original-md-7"
6-
print "```nu"
7-
print ("let $var1 = 'foo'" | nu-highlight)
8-
print '```
9-
```output-numd'
5+
print "#code-block-starting-line-in-original-md-7"
6+
print "```nu"
7+
print ("let $var1 = 'foo'" | nu-highlight)
8+
9+
print "```\n```output-numd"
10+
1011
let $var1 = 'foo'
1112

12-
print "```"
13-
print "###code-block-starting-line-in-original-md-13"
14-
print "```nu"
15-
print ("# This chunk will produce some output in the separate block
16-
ls; # mind that this ls won't print in the markdown as it is used without `echo` or `>`
13+
print "```"
14+
15+
print "#code-block-starting-line-in-original-md-13"
16+
print "```nu"
17+
print ("# This chunk will produce some output in a separate block
1718
$var1 | path join 'baz' 'bar'" | nu-highlight)
18-
print '```
19-
```output-numd'
20-
# This chunk will produce some output in the separate block
21-
ls; # mind that this ls won't print in the markdown as it is used without `echo` or `>`
22-
$var1 | path join 'baz' 'bar' | print
2319

24-
print "```"
25-
print "###code-block-starting-line-in-original-md-24"
26-
print "```nu"
27-
print ("# This chunk will output results inline" | nu-highlight)
20+
print "```\n```output-numd"
21+
22+
# This chunk will produce some output in a separate block
23+
$var1 | path join 'baz' 'bar' | print; print ''
24+
25+
print "```"
26+
27+
print "#code-block-starting-line-in-original-md-23"
28+
print "```nu"
29+
print ("# This chunk will output results inline" | nu-highlight)
30+
31+
32+
print ("> whoami" | nu-highlight)
33+
34+
whoami | print; print ''
2835

29-
print ("> whoami" | nu-highlight)
30-
whoami | print
36+
print ("> 2 + 2" | nu-highlight)
3137

32-
print ("> 2 + 2" | nu-highlight)
33-
2 + 2 | print
38+
2 + 2 | print; print ''
3439

35-
print "```"
40+
print "```"

examples/1_simple_markdown/simple_markdown_with_no_output.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ let $var1 = 'foo'
1111
## Example 2
1212

1313
```nu
14-
# This chunk will produce some output in the separate block
15-
ls; # mind that this ls won't print in the markdown as it is used without `echo` or `>`
14+
# This chunk will produce some output in a separate block
1615
$var1 | path join 'baz' 'bar'
1716
```
1817

0 commit comments

Comments
 (0)