Fix some examples and regenerate docs, should fix: #4455 (#4639)

This commit is contained in:
Justin Ma 2022-02-25 21:14:15 +08:00 committed by GitHub
parent 2126bef052
commit e6570b41ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 25 additions and 4 deletions

View File

@ -59,7 +59,7 @@ impl Command for Compact {
}),
},
Example {
description: "Filter out all instances of nothing from a list (Returns [1,2]",
description: "Filter out all instances of nothing from a list (Returns [1,2])",
example: r#"echo [1, $nothing, 2] | compact"#,
result: Some(Value::List {
vals: vec![Value::test_int(1), Value::test_int(2)],

View File

@ -66,7 +66,7 @@ impl Command for Base64 {
},
Example {
description: "Base64 encode a string with the binhex character set",
example: "echo 'username:password' | hash base64 --character_set binhex --encode",
example: "echo 'username:password' | hash base64 --character-set binhex --encode",
result: Some(Value::string("F@0NEPjJD97kE'&bEhFZEP3", Span::test_data())),
},
Example {

View File

@ -26,7 +26,7 @@ Filter out all records where 'World' is null (Returns the table)
> echo [["Hello" "World"]; [$nothing 3]]| compact World
```
Filter out all instances of nothing from a list (Returns [1,2]
Filter out all instances of nothing from a list (Returns [1,2])
```shell
> echo [1, $nothing, 2] | compact
```

View File

@ -9,3 +9,10 @@ Export custom commands or environment variables from a module.
## Signature
```> export ```
## Examples
Export a definition from a module
```shell
> module utils { export def my-command [] { "hello" } }; use utils my-command; my-command
```

View File

@ -14,3 +14,10 @@ Define a signature for an external command
- `def_name`: definition name
- `params`: parameters
## Examples
Write a signature for an external command
```shell
> extern echo [text: string]
```

View File

@ -27,7 +27,7 @@ Base64 encode a string with default settings
Base64 encode a string with the binhex character set
```shell
> echo 'username:password' | hash base64 --character_set binhex --encode
> echo 'username:password' | hash base64 --character-set binhex --encode
```
Base64 decode a value

View File

@ -15,3 +15,10 @@ Runs external command
- `...rest`: external command to run
- `--redirect-stdout`: redirect-stdout
- `--redirect-stderr`: redirect-stderr
## Examples
Run an external command
```shell
> run-external "echo" "-n" "hello"
```