Dan Davison
df94052180
Declare input and output types of commands ( #6796 )
...
* Add failing test that list of ints and floats is List<Number>
* Start defining subtype relation
* Make it possible to declare input and output types for commands
- Enforce them in tests
* Declare input and output types of commands
* Add formatted signatures to `help commands` table
* Revert SyntaxShape::Table -> Type::Table change
* Revert unnecessary derive(Hash) on SyntaxShape
Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
2022-11-10 10:55:05 +13:00
Alex Saveau
be5d71ea47
Run a round of clippy --fix to fix a ton of lints ( #7006 )
...
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-11-04 15:11:17 -05:00
Darren Schroeder
bb968304da
bump rust-toolchain to 1.64 ( #7005 )
...
* bump rust-toolchain to 1.64
* 1.64 clippy
2022-11-04 10:27:23 -05:00
WindSoilder
e46d610f77
Refactor: finish refactor on commands which take optional cell paths. ( #6961 )
...
* refactor on conversions module
* finish refactor on strings command
* simplify code
* rename from ArgumentsCp to CellPathOnlyArgs
* fmt code
* refactor on hash relative commands
2022-11-01 12:40:11 +01:00
Darren Schroeder
f48de73236
change str distance to output value::int ( #6963 )
...
* change str distance to output value::int
* update the test
2022-10-31 10:28:04 -05:00
WindSoilder
457514590d
Refactor: introduce general operate
commands to reduce duplicate code ( #6879 )
...
* make format filesize more flexible
* make code simpler
* finish refactor on bytes commands
* finish refactor on str commands
* fimplify code
* rename from column_paths to cell_paths
2022-10-29 16:29:46 -05:00
Leon
5add5cbd12
Further edits to help messages ( #6913 )
2022-10-26 09:36:42 -07:00
Andrey Filipenkov
902aad6016
fix description of build-string's second example ( #6912 )
2022-10-26 09:36:31 -05:00
Reilly Wood
17b2bcc125
Support range in str substring ( #6867 )
2022-10-23 11:42:17 +02:00
Jake Albert
34c8b276ab
Return Error on str replace
RegEx parse fail ( #6695 )
2022-10-10 07:27:01 -05:00
MichelMunoz
7f21b7fd7e
6582 - Incorrect documentation for some string operations ( #6610 )
...
* 6582 - Incorrect documentation for some string operations
* Update crates/nu-command/src/strings/str_/contains.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* Update crates/nu-command/src/strings/str_/ends_with.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* Update crates/nu-command/src/strings/str_/index_of.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* Update crates/nu-command/src/strings/str_/starts_with.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* Run rustfmt
Co-authored-by: MichelMunoz <>
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2022-09-25 18:09:09 +02:00
Dan Davison
4926865c4e
str collect
=> str join
(#6531 )
...
* Initialize join.rs as a copy of collect.rs
* Evolve StrCollect into StrJoin
* Replace 'str collect' with 'str join' everywhere
git ls-files | lines | par-each { |it| sed -i 's,str collect,str join,g' $it }
* Deprecate 'str collect'
* Revert "Deprecate 'str collect'"
This reverts commit 959d14203e
.
* Change `str collect` help message to say that it is deprecated
We cannot remove `str collect` currently (i.e. via
`nu_protocol::ShellError::DeprecatedCommand` since a prominent project
uses the API:
b85542c31c/src/virtualenv/activation/nushell/activate.nu (L43)
2022-09-11 11:48:27 +03:00
pwygab
d1e1d0ac3e
remove panic from lpad
and rpad
, change truncation behaviour for lpad
( #6495 )
...
* condense `lpad` and `rpad` into `pad`
* change description
* back to original names, add change
2022-09-08 14:29:56 +02:00
JayceFayne
2030e25ddc
fix typo ( #6508 )
2022-09-07 16:16:55 +08:00
Stefan Holderbach
ab77bf3289
Fix search terms for str distance
( #6398 )
...
Redundancy with the command name is unnecessary and now tested since #6380
Fixes CI failure
2022-08-24 11:49:03 +02:00
Stefan Holderbach
0afe1e4e67
Test command names and search terms for redundancy ( #6380 )
...
* Test commands for proper names and search terms
Assert that the `Command.name()` is equal to `Signature.name`
Check that search terms are not just substrings of the command name as
they would not help finding the command.
* Clean up search terms
Remove redundant terms that just replicate the command name.
Try to eliminate substring between search terms, clean up where
necessary.
2022-08-24 11:16:47 +02:00
Darren Schroeder
ba6abd77c9
add another split words example ( #6394 )
2022-08-23 13:27:06 -05:00
Darren Schroeder
6fbc76bc0f
add edit distance/levenshtein command ( #6383 )
...
* add edit distance/levenshtein command
* change output to a record
* update test
2022-08-23 08:53:14 -05:00
Darren Schroeder
99c42582fe
add a split words command ( #6363 )
...
* add a split words command
* changed regex
2022-08-20 05:55:54 +12:00
Stefan Holderbach
c2f4969d4f
Clippy fix for Rust 1.63 ( #6299 )
...
Take more sensitive lints into account
Somewhat ugly in some cases is the replacement of `.get(0)` with
`.first()`
2022-08-11 11:54:54 -05:00
Darren Schroeder
cdeb8de75d
replace the regex crate with the fancy-regex crate ( #6227 )
2022-08-04 14:51:02 -05:00
Justin Ma
ce6df93d05
Add bits shl
and bits shr
command ( #6202 )
...
* Add `bits shift-left` and `bits shift-right` command
* update bits shift error tips
* some code refactor
* update shift right
* some code refactor for bits shift commands
* rename bits shift commands align with bits operators
* update search term
* Update crates/nu-command/src/bits/not.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* Update crates/nu-command/src/bits/shift_left.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* Update crates/nu-command/src/bits/shift_right.rs
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
* ci skip
* change default number-bytes for bits shift
* fix bits not tests
* fix bits tests
Co-authored-by: Stefan Holderbach <sholderbach@users.noreply.github.com>
2022-08-02 15:52:04 -05:00
pwygab
8f00848ff9
add a fair amount ofsearch terms ( #6090 )
2022-07-21 06:29:41 -05:00
pwygab
57a6465ba0
add split list
subcommand to split up lists ( #6062 )
...
* add `split list` subcommand to split up lists
* fmt
* fix shoddy signature
2022-07-16 06:24:37 -05:00
pwygab
3d45f77692
add wc
search term for size
and length
( #6056 )
2022-07-15 10:17:14 -05:00
Benoît Cortier
32f0f94b46
feat: add --binary(-b)
option to hash
commands ( #5885 )
...
For instance,
```
echo 'abcdefghijklmnopqrstuvwxyz' | hash sha256 --binary
```
Will returns the hash as a binary value instead of a hexadecimaly encoded string.
2022-06-26 06:50:56 -05:00
Darren Schroeder
a142d1a192
update encode decode with new signature ( #5881 )
2022-06-25 19:06:39 -05:00
Benoît Cortier
173d60d59d
Deprecate hash base64
, extend decode
and add encode
commands ( #5863 )
...
* feat: deprecate `hash base64` command
* feat: extend `decode` and `encode` command families
This commit
- Adds `encode` command family
- Backports `hash base64` features to `encode base64` and `decode base64` subcommands.
- Refactors code a bit and extends tests for encodings
- `decode base64` returns a binary `Value` (that may be decoded into a string using `decode` command)
* feat: add `--binary(-b)` flag to `decode base64`
Default output type is now string, but binary can be requested using this new flag.
2022-06-26 00:35:23 +03:00
Fernando Herrera
8d5848c955
bool type for binary operations ( #5779 )
...
* bool type for binary operations
* fixed type in commands
2022-06-14 20:31:14 -05:00
pwygab
8318d59ef1
improve str substring ( #5730 )
2022-06-07 06:09:16 -05:00
Jae-Heon Ji
820a6bfb08
feat: add search terms to category of strings ( #5723 )
2022-06-06 08:47:09 -05:00
Justin Ma
d44059c36b
feat: Add sensitive flag to get, fix #4295 ( #5685 )
...
* feat: Add insensitive flag to get, fix #4295
* add get insensitive example
* Fix get flags
* Update get examples
2022-06-01 08:34:42 -05:00
victormanueltn
1f8ccd8e5e
Add search term to str substring command. ( #5603 )
2022-05-21 11:40:37 +03:00
krober
1e94793df5
Add str title-case ( #5573 )
...
Co-authored-by: kyle <kyle@archtop.local>
2022-05-18 08:57:20 -05:00
WindSoilder
5fa42eeb8c
Make format support nested column and use variable ( #5570 )
...
* fix format for nested structure
* make little revert
* add tests
* fix format
* better comment
* make better comment
2022-05-18 06:08:43 -05:00
krober
3e09158afc
Move capitalize, downcase, upcase to /cases; fix some example descriptions; clarify usage text ( #5572 )
...
Co-authored-by: kyle <kyle@archtop.local>
2022-05-18 00:55:43 -04:00
victormanueltn
a22d70718f
Add search terms to build-string command. ( #5557 )
2022-05-16 12:21:01 -07:00
WindSoilder
d88d057bf6
keep metadata while format filesize ( #5502 )
2022-05-10 11:24:06 -05:00
WindSoilder
8030f7e9f0
add format filesize ( #5498 )
...
* add format filesize
* add comment
* add comment
* remove comment
2022-05-10 06:35:14 -05:00
Yuheng Su
fbdb125141
Add split number flag in split row
( #5434 )
...
Signed-off-by: Yuheng Su <gipsyh.icu@gmail.com>
2022-05-06 10:53:02 -05:00
JT
76079d5183
Move config to be an env var ( #5230 )
...
* Move config to be an env var
* fix fmt and tests
2022-04-19 10:28:01 +12:00
Kat Marchán
1314a87cb0
update miette and switch to GenericErrors ( #5222 )
2022-04-19 00:34:10 +12:00
Tiffany Bennett
7490392eb9
Add char -i
for chars from integers ( #5183 )
...
* Revert "Allow integer to `char -u` (#5174 )"
This reverts commit cfefb65d55
.
* Add `char -i`
* Reword example
2022-04-14 08:34:02 -05:00
Tiffany Bennett
cfefb65d55
Allow integer to char -u
( #5174 )
2022-04-13 13:33:08 +03:00
Hristo Filaretov
683b912263
Track call arguments in a single list ( #5125 )
...
* Initial implementation of ordered call args
* Run cargo fmt
* Fix some clippy lints
* Add positional len and nth
* Cargo fmt
* Remove more old nth calls
* Good ole rustfmt
* Add named len
Co-authored-by: Hristo Filaretov <h.filaretov@protonmail.com>
2022-04-09 14:55:02 +12:00
Darren Schroeder
74d0f19291
added ability to opt in to normal string replacement in replace
cmd ( #5133 )
...
* added ability to opt in to normal string replacement in `replace` cmd
* type-o
2022-04-08 12:23:16 -05:00
Reilly Wood
d38a3a8b4e
Fix command descriptions+examples ( #5129 )
...
* Fix exit usage
* Move dfr as-date* format examples to extra_usage
* Update command usage and examples
* More docs on `str trim`
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-04-08 10:30:49 +02:00
Darren Schroeder
4129f15eb9
update str find-replace
to str replace
( #5120 )
2022-04-07 08:41:09 -05:00
Reilly Wood
d64cf1687e
Fix Format for non-basic data types ( #5095 )
2022-04-05 07:45:38 -05:00
Reilly Wood
657b631fdc
Add search terms to many commands ( #5096 )
2022-04-05 07:01:21 -05:00