Commit Graph

3175 Commits

Author SHA1 Message Date
Jonathan Turner
c83aea3c89
Bump to 0.26.1 (#3008) 2021-02-05 19:38:04 +13:00
Jonathan Turner
67aaf4cb2d
fix the ps command's virtual mem (#3007) 2021-02-05 18:57:49 +13:00
Darren Schroeder
3083346884
update sysinfo to v16 (#3006) 2021-02-05 06:59:24 +13:00
Yehuda Katz
d07789677f
Clean up lexer (#2956)
* Document the lexer and lightly improve its names

The bulk of this pull request adds a substantial amount of new inline
documentation for the lexer. Along the way, I made a few minor changes
to the names in the lexer, most of which were internal.

The main change that affects other files is renaming `group` to `block`,
since the function is actually parsing a block (a list of groups).

* Further clean up the lexer

- Consolidate the logic of the various token builders into a single type
- Improve and clean up the event-driven BlockParser
- Clean up comment parsing. Comments now contain their original leading
  whitespace as well as trailing whitespace, and know how to move some
  leading whitespace back into the body based on how the lexer decides
  to dedent the comments. This preserves the original whitespace
  information while still making it straight-forward to eliminate leading
  whitespace in help comments.

* Update meta.rs

* WIP

* fix clippy

* remove unwraps

* remove unwraps

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
Co-authored-by: Jonathan Turner <jonathan.d.turner@gmail.com>
2021-02-04 20:20:21 +13:00
Darren Schroeder
fb1846120d
standardize on how to get file size (#2992)
* standardize on how to get file size

* forgot to remove comment

* make specified size lowercase

* fix the test due to precision

* added another test

* Update README.md

add contributors graphic

* clippy - test adjustment

* tweaked matching
2021-02-03 07:19:38 -06:00
Jonathan Turner
da1e1295ea
Update README.md 2021-02-03 15:08:18 +13:00
Darren Schroeder
ecaea57263
Value helpers (#3000)
* Update README.md

add contributors graphic

* just a couple of helpers

* separated some helpers out to individual fns
2021-02-03 15:06:11 +13:00
Andrés N. Robalino
fa928bd25d
Minimal markdown syntax per element support. (#2997) 2021-02-02 12:09:19 -05:00
Diogo Edegar Mafra
c1981dfc26
Fix README formatting (#2996) 2021-02-02 19:23:38 +13:00
Darren Schroeder
fd41fa31d5
add $nothing and tests (#2995) 2021-02-02 19:23:12 +13:00
Darren Schroeder
2c52144f41
Update README.md (#2993)
add contributors graphic
2021-02-02 07:05:37 +13:00
Darren Schroeder
87c7898b65
update sysinfo due to breaking change with get_version (#2988) 2021-01-30 12:21:32 -06:00
Jonathan Turner
44e088c6fe
Move filesize to use bigint (#2984)
* Move filesize to be bigint-sized

* Add tests and fix filesize display

* clippy
2021-01-30 11:35:18 +13:00
Ingvar Stepanyan
7b4cbd7ce9
Few fixes for WASI build (#2983)
- Disable shadow-rs (libgit2-sys compilation on WASI fails for various strange reasons, so seems easier to disable altogether for now).
 - Disable directories-support (WASI doesn't have concept of user directory and such calls fail at runtime).
2021-01-30 09:11:07 +13:00
Darren Schroeder
b052d524da
added pow operator, and filesize math (#2976)
* added pow operator, and filesize math

* removed + and - arms, removed some pow, pow higher precedence

* Update value.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-01-29 07:44:02 -06:00
Darren Schroeder
47c4b8e88a
allow str from to convert more things to string (#2977)
* allow str from to convert more things to string

* fixed FileSize so it reports with units configured

* added tests
2021-01-29 07:43:35 -06:00
Leonhard Kipp
d0a2a02eea
Add possibility to declare optional parameters and switch flags (#2966)
* Add possibility to declare optional parameters and switch flags

With this commit applied it is now possible to specify optional parameters and flags
as switches. This PR **only** makes guarantees about **parsing** optional flags and
switches correctly. This PR **does not guarantee flawless functionality** of
optional parameters / switches within scripts.
functionality within scripts. Example:

test.nu
```shell
def my_command [
    opt_param?
    opt_param2?: int
    --switch
] {echo hi nushell}
```

```shell
> source test.nu
> my_command -h
───┬─────────
 0 │ hi
 1 │ nushell
───┴─────────
Usage:
  > my_command <mandatory_param> (opt_param) (opt_param2) {flags}

Parameters:
  <mandatory_param>
  (opt_param)
  (opt_param2)

Flags:
  -h, --help: Display this help message
  --switch
  --opt_flag <any>
```

* Update def docs
2021-01-28 06:31:29 +13:00
Darren Schroeder
b1e1dab4cb
add % operator for modulus, work with decimals (#2975)
* add % operator, work with decimals

* removed the % operator to reserve for something else
2021-01-26 12:42:34 -06:00
Jonathan Turner
388973e9ab
Bump to 0.26.0 (#2974) 2021-01-26 23:07:08 +13:00
Darren Schroeder
2129ec7558
allow pad to use multi-byte chars (#2973) 2021-01-26 22:09:38 +13:00
Jonathan Turner
82f122525c
Delete nushell-demo.svg 2021-01-25 20:35:10 +13:00
Jonathan Turner
7c4c00f1e6
Update README.md 2021-01-25 20:34:05 +13:00
Jonathan Turner
fe6c7dc10a
Add files via upload 2021-01-25 20:33:06 +13:00
Joseph T. Lyons
9bc24e3b12
Remove unnecessary clone() (#2970) 2021-01-25 20:13:05 +13:00
Jonathan Turner
833baca66e
Add a new animated demo (#2971) 2021-01-25 20:12:44 +13:00
Joseph T. Lyons
9fd92512a2
Use equality assert macros (#2969) 2021-01-25 18:16:10 +13:00
Jonathan Turner
b692ca7896
Fix ps sys units (#2967)
* Fix the units for sys and ps

* Better conversion
2021-01-25 08:34:43 +13:00
Jonathan Turner
52dc04a35a
Error on bad row in column path (#2964)
* Error on bad row in column path

* Add more pathing tests
2021-01-22 18:14:13 -05:00
Andrés N. Robalino
42b1287759
Parity and anchor carrying for str command suite. (#2965)
Bring the majority of str sub commands to parity supporting their actions
by column paths. Ensuring they carry over anchor meta data as well.
2021-01-22 18:13:30 -05:00
Darren Schroeder
5a471aa1d0
fixed char signature (#2963) 2021-01-22 15:48:31 -06:00
Jonathan Turner
a4b8d4a098
Add rest support to blocks (#2962) 2021-01-23 10:28:32 +13:00
Darren Schroeder
a3be6affa4
fix some misalignment errors (#2959) 2021-01-23 07:39:09 +13:00
Leonhard Kipp
71b99edd48
parser/add rest args to def (#2961)
* Add rest arg to def

This commit applied adds the ability to define the rest parameter of a def
command. It does not implement the functionality to expand the rest argument in
a user defined def function.

The rest argument has to be exactly worded "...rest".

Example after this PR is applied:

file test.nu
```shell
def my_command [
    ...rest:int # My rest arg
] {
    echo 1 2 3
}
```

```shell
> source test.nu
> my_command -h
Usage:
  > my_command ...args {flags}

Parameters:
  ...args: My rest arg

Flags:
  -h, --help: Display this help message
```

* Fix space in help on wrong side
2021-01-23 07:13:29 +13:00
Rust大闸蟹
64553ddcb7
upgrade shadow-rs 0.5.23 (#2960)
* update to shadow-rs 0.4. use easy

* update shadow-rs to 0.5

* fix version not used

* update

* update Cargo.lock

* update Cargo.lock

* fix wasm build error when use dependence git2
fix error link:https://dev.azure.com/nushell/nushell/_build/results?buildId=4858&view=logs&j=1a745d4c-b027-5f34-06d8-d6f256bfe9f9&t=a0a335cb-fa1f-5bbf-be01-1a90d6899e54

* remove code not used; fix warning by RUSTFLAGS="-D warnings" build error

* upgrade shadow-rs 0.5.2

* upgrade shadow-rs 0.5.7

make nushell reduce dependence crates smaller and  build fast.

* upgrade shadow-rs 0.5.8

fix when use api 'strip_prefix()' method in less than rust1.45.0 build failed

* fix https://github.com/baoyachi/shadow-rs/issues?q=is%3Aissue+is%3Aclosed
2021-01-23 07:09:57 +13:00
Andrés N. Robalino
2a42482ae9
Clean up and refactoring examples tests. (#2957) 2021-01-20 21:07:16 -05:00
Darren Schroeder
11f345a8ae
added more char escapes (#2955)
* added more char escapes

* move commands with \x1b over from char.rs to ansi.rs
2021-01-21 13:15:58 +13:00
Leonhard Kipp
fec50d8cfe
Fix bug #2921 (#2945)
* Fix bug #2921

Moving whether a range should be parsed further back, giving e.G. parsing of
invocations precedence fixes the bug

* Add test
2021-01-21 07:58:37 +13:00
Jakub Žádník
05e42381df
Add --skip flag to nth command (#2953)
clippy & rustfmt included
2021-01-21 06:37:30 +13:00
Jonathan Turner
b435075e09
Temporarily(?) switch from heim+uom to sysinfo (#2954)
* Switch from heim to sysinfo

* WIP

* more cleanup

* fmt

* lint
2021-01-20 20:18:38 +13:00
Caden Haustein
430da53f0b
Replace dirs and directories with maintained (#2949) 2021-01-19 14:24:27 -06:00
Jonathan Turner
2e6d836dd1
Flush out! lines, helps autoview (#2952) 2021-01-20 07:23:37 +13:00
ahkrr
899d324a9c
fix: error Variable not in scope for a def parameter #2901 (#2951)
adding tests to notice regressions on this issue

Co-authored-by: hk <alexhaka10@protonmail.com>
2021-01-20 07:21:11 +13:00
Leonhard Kipp
576ed6a906
parser/split long short flags (#2944)
* Remove wrong test case

* Parse long and shortflags without space correctly

* Update param_flag_list.rs

* Update param_flag_list.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
2021-01-20 07:19:53 +13:00
Jan Keromnes
d744cf8437
[Gitpod] Don't test removed feature 'test-bins' (#2948)
Fixes nushell/nushell#2947
2021-01-19 22:43:42 +13:00
Rust大闸蟹
088e662285
Replace git current_branch to shadow-rs branch (#2935)
* update to shadow-rs 0.4. use easy

* update shadow-rs to 0.5

* fix version not used

* update

* update Cargo.lock

* update Cargo.lock

* fix wasm build error when use dependence git2
fix error link:https://dev.azure.com/nushell/nushell/_build/results?buildId=4858&view=logs&j=1a745d4c-b027-5f34-06d8-d6f256bfe9f9&t=a0a335cb-fa1f-5bbf-be01-1a90d6899e54

* remove code not used; fix warning by RUSTFLAGS="-D warnings" build error

* upgrade shadow-rs 0.5.2

* upgrade shadow-rs 0.5.7

make nushell reduce dependence crates smaller and  build fast.

* upgrade shadow-rs 0.5.8

fix when use api 'strip_prefix()' method in less than rust1.45.0 build failed

* use shadow-rs branch replace with current_branch method;
remove and reduce git dependencies.

* upgrade shadow-rs 0.5.12-pre,test build error with wasm

* upgrade Cargo.lock

* upgarde shadow-rs depencdence

* fix build error in wasm

* add clippy warning
2021-01-16 07:06:29 +13:00
Leonhard Kipp
f9b0b81eb2
Add def documentation (#2939) 2021-01-15 20:21:18 +13:00
Darren Schroeder
c5485c6501
a small regex optimization (#2937)
* a small regex optimization

* removed comments
2021-01-15 20:20:28 +13:00
Andrés N. Robalino
d8ed01400f
str set sub command removal. (#2940) 2021-01-14 18:55:37 -05:00
Anders Rasmussen
ebc4694e05
move keybinding_path to nu-data (#2927) 2021-01-14 06:31:47 +13:00
Coen Fox
a9441d670e
Revert tab completion changes (#2929)
* Undo tab completion changes

* Remove extra newline
2021-01-14 06:29:18 +13:00