Commit Graph

453 Commits

Author SHA1 Message Date
JT
c6cb491e77
bump to 0.66 (#6137) 2022-07-27 07:56:14 +12:00
Darren Schroeder
d856ac92f4
expand durations to include month, year, decade (#6123)
* expand durations to include month, year, decade

* remove commented out fn

* oops, found more debug comments

* tweaked tests for the new way, borrowed heavily from chrono-humanize-rs

* clippy

* grammar
2022-07-26 08:05:37 -05:00
JT
475d32045f
Revert "Refactor external command (#6083)" (#6116)
This reverts commit 0646f1118c.
2022-07-26 05:37:15 +12:00
nibon7
32e4535f24
Simplify eval_block (#6121)
Signed-off-by: nibon7 <nibon7@163.com>
2022-07-25 12:00:31 -05:00
Kangaxx-0
0646f1118c
Refactor external command (#6083)
Co-authored-by: Frank <v-frankz@microsoft.com>
2022-07-21 19:56:57 -04:00
WindSoilder
a35a71fd82
Make Semicolon stop on error (#6079)
* introduce external command runs to failed error, and implement semicolon relative logic

* ignore test due to semicolon works

* not raise ShellError for external commands

* update comment

* add relative test in for windows

* fix type-o

Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
2022-07-20 07:44:42 -05:00
Darren Schroeder
9b6b817276
update some dependencies (#6009)
* update some dependencies

* there may be some bugs here but it seems to compile and run

* clippy
2022-07-11 11:18:06 -05:00
默可思
221f36ca65
Add --directory (-D) flag to ls, list the directory itself instead of its contents (#5970)
* Avoid extending the directory without globs in `nu_engine::glob_from`

* avoid joining a `*` to the directory without globs

* remove checks on directory permission and whether it is empty

The previous implemention of `nu_engine::glob_from` will extend the
given directory even if it containes no glob pattern. This commit
overcomes lack of consistency with the function `nu_glob::glob`.

* Add flag -D to ls, to list the directory itself instead of its contents

* add --directory (-d) flag to ls

* correct the difference between the given path and the cwd

* set default path to `.` instead of `./*` when --directory (-d) flag is true

* add comments

* add an example

* add tests

* fmt
2022-07-08 14:15:34 -05:00
Justin Ma
de162c9aea
Bump to 0.65.1 dev version (#5962) 2022-07-06 16:25:09 +12:00
JT
0d40d0438f
bump to 0.65 (#5952) 2022-07-05 17:54:16 +12:00
Justin Ma
4e90b478b7
Add bit operator: bit-xor (#5940) 2022-07-03 06:45:20 -05:00
JT
a48616697a
Rename bitwise operators for readability (#5937) 2022-07-02 17:05:02 -05:00
Justin Ma
b82dccf0bd
Add band and bor operator for bit operations (#5936)
* Add `band` and `bor` Operator

* Add tests
2022-07-02 13:03:36 -05:00
Justin Ma
3917fda7ed
Update #4202: Add shift operator bshl and bshr for integers (#5928)
* Update #4202: Add shift operator bshl and bshr for integers

* Add more tests
2022-07-02 06:48:43 -05:00
pwygab
cf0877bf72
ensure required positionals don't show up as optional when help (#5916)
* ensure `required` positionals show up as `required` when `help`

* moves it to the older format

* standardises across optional and required parameters
2022-07-01 05:51:41 +12:00
JT
575ddbd4ef
Clippy and remove unused is_binary (#5879) 2022-06-26 08:20:28 +12:00
JT
533e04a60a
Bump to 0.64.1 dev version (#5865) 2022-06-24 16:47:00 +12:00
pwygab
ff73623873
shows location of sqlite3 history file (#5784)
* shows location of sqlite3 file

* fmt
2022-06-15 10:06:49 +02:00
JT
d1c719a8cc
bump to 0.64 (#5777)
Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-06-15 14:39:17 +12:00
phiresky
42dbfd1fa0
SQLite History MVP with timestamp, duration, working directory, exit status metadata (#5721)
This PR adds support for an SQLite history via nushell/reedline#401

The SQLite history is enabled by setting history_file_format: "sqlite" in config.nu.

* somewhat working sqlite history
* Hook up history command
* Fix error in SQlitebacked with empty lines

When entering an empty line there previously was the "No command run"
error with `SqliteBackedHistory` during addition of the metadata

May be considered a temporary fix

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-06-14 22:53:33 +02:00
pwygab
caafd26deb
Attempts to add // math operator (#5759)
* attempts to add `div` math operator

* allows `//` to be used too

* fmt:

* clippy issue

* returns appropriate type

* returns appropriate type 2

* fmt

* ensure consistency; rename to `fdiv`

* Update parser.rs
2022-06-13 13:54:47 +03:00
Fernando Herrera
d5b99ae316
input and output types (#5750)
* input and output types

* added description

* type from stored variable

* string in custom value

* more tests with non custom
2022-06-10 10:59:35 -05:00
Jakub Žádník
5bae7e56ef
Add $nu.scope.engine_state (#5739)
* Add number of items present in engine state

* Rename num_decls column to num_commands
2022-06-08 13:31:36 -05:00
sec65
3c421c5726
Added loginshell config file #4620 (#5714)
* Added loginshell config file #4620

* added sample login.nu

* added environment variable loginshell-path
2022-06-06 06:52:37 -05:00
Herlon Aguiar
e4a22799d5
nu-engine: better display for shape when showing help params (#5715) 2022-06-05 08:13:04 -05:00
Stefan Holderbach
e5d38dcff6
Address lints from clippy for beta/nightly (#5709)
* Fix clippy lints in tests

* Replace `format!` in `.push_str()` with `write!`

Stylistically that might be a bit rough but elides an allocation.

Fallibility of allocation is more explicit, but ignored with `let _ =`
like in the clippy example:

https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string

* Remove unused lifetime

* Fix macro crate relative import

* Derive `Eq` for `PartialEq` with `Eq` members

https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

* Remove unnnecessary `.to_string()` for Cow<str>

* Remove `.to_string()` for `tendril::Tendril`

Implements `Deref<Target = str>`
2022-06-04 18:47:36 +12: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
WindSoilder
0769e9b750
make ls works better with glob (#5691)
* fix glob behavior

* fix doc
2022-05-30 19:13:27 -05:00
WindSoilder
9602e82029
make sure no duplicate records exists during eval and merge (#5633) 2022-05-25 19:10:31 -05:00
JT
8e98df8b28
bump to dev version (#5635) 2022-05-25 19:09:44 -05:00
JT
06cf3fa5ad
Bump to 0.63 (#5627) 2022-05-25 11:33:28 +12:00
Darren Schroeder
f0cb2f38df
refactor all write_alls to ensure flushing (#5567) 2022-05-17 13:28:18 -05:00
WindSoilder
a61d09222f
document out positional argument type (#5461) 2022-05-08 08:11:28 -05:00
JT
374757f286
Bump to the 0.62.1 dev version (#5473) 2022-05-08 08:38:12 +12:00
Jakub Žádník
9b99b2f6ac
Overlays (#5375)
* WIP: Start laying overlays

* Rename Overlay->Module; Start adding overlay

* Revamp adding overlay

* Add overlay add tests; Disable debug print

* Fix overlay add; Add overlay remove

* Add overlay remove tests

* Add missing overlay remove file

* Add overlay list command

* (WIP?) Enable overlays for env vars

* Move OverlayFrames to ScopeFrames

* (WIP) Move everything to overlays only

ScopeFrame contains nothing but overlays now

* Fix predecls

* Fix wrong overlay id translation and aliases

* Fix broken env lookup logic

* Remove TODOs

* Add overlay add + remove for environment

* Add a few overlay tests; Fix overlay add name

* Some cleanup; Fix overlay add/remove names

* Clippy

* Fmt

* Remove walls of comments

* List overlays from stack; Add debugging flag

Currently, the engine state ordering is somehow broken.

* Fix (?) overlay list test

* Fix tests on Windows

* Fix activated overlay ordering

* Check for active overlays equality in overlay list

This removes the -p flag: Either both parser and engine will have the
same overlays, or the command will fail.

* Add merging on overlay remove

* Change help message and comment

* Add some remove-merge/discard tests

* (WIP) Track removed overlays properly

* Clippy; Fmt

* Fix getting last overlay; Fix predecls in overlays

* Remove merging; Fix re-add overwriting stuff

Also some error message tweaks.

* Fix overlay error in the engine

* Update variable_completions.rs

* Adds flags and optional arguments to view-source (#5446)

* added flags and optional arguments to view-source

* removed redundant code

* removed redundant code

* fmt

* fix bug in shell_integration (#5450)

* fix bug in shell_integration

* add some comments

* enable cd to work with directory abbreviations (#5452)

* enable cd to work with abbreviations

* add abbreviation example

* fix tests

* make it configurable

* make cd recornize symblic link (#5454)

* implement seq char command to generate single character sequence (#5453)

* add tmp code

* add seq char command

* Add split number flag in `split row` (#5434)

Signed-off-by: Yuheng Su <gipsyh.icu@gmail.com>

* Add two more overlay tests

* Add ModuleId to OverlayFrame

* Fix env conversion accidentally activating overlay

It activated overlay from permanent state prematurely which would
cause `overlay add` to misbehave.

* Remove unused parameter; Add overlay list test

* Remove added traces

* Add overlay commands examples

* Modify TODO

* Fix $nu.scope iteration

* Disallow removing default overlay

* Refactor some parser errors

* Remove last overlay if no argument

* Diversify overlay examples

* Make it possible to update overlay's module

In case the origin module updates, the overlay add loads the new module,
makes it overlay's origin and applies the changes. Before, it was
impossible to update the overlay if the module changed.

Co-authored-by: JT <547158+jntrnr@users.noreply.github.com>
Co-authored-by: pwygab <88221256+merelymyself@users.noreply.github.com>
Co-authored-by: Darren Schroeder <343840+fdncred@users.noreply.github.com>
Co-authored-by: WindSoilder <WindSoilder@outlook.com>
Co-authored-by: Yuheng Su <gipsyh.icu@gmail.com>
2022-05-08 07:39:22 +12:00
JT
d306b834ca
Bump to 0.62 (#5422) 2022-05-04 09:01:27 +12:00
Yuheng Su
7c9a78d922
Fixed ctrl-c in recursion loop bug #5362 (#5409) 2022-05-02 20:18:25 +12:00
panicbit
49cbc30974
Add ends-with operator and fix dataframe operator behavior (#5395)
* add ends-with operator

* escape needles in dataframe operator regex patterns
2022-05-02 20:02:38 +12:00
Darren Schroeder
e2b510b65e
update sys with new items, add kernel version to os-info (#5308)
* update sys with new items, add kernel version to os-info

* clippy
2022-04-23 16:33:27 -05:00
Herlon Aguiar
b9eb213f36
nu-cli/completions: added completion for $nu (#5303) 2022-04-23 11:49:17 +12:00
JT
cc78446ffd
Fix cd - (#5301) 2022-04-23 11:48:10 +12:00
Herlon Aguiar
5ff2ae628b
nu-cli: directory syntax shape + completions (#5299) 2022-04-22 15:18:51 -05:00
Reilly Wood
a26272b44b
Clean up tests and unused documentation code (#5273)
* Delete unused documentation code+test

* Fix up test to account for new select behavior
2022-04-21 06:13:58 -05:00
Darren Schroeder
d1cc70fc4a
update os-info os to name (#5265) 2022-04-21 10:36:39 +12:00
Darren Schroeder
f2d47f97da
add os to $nu based on rust's understanding (#5243)
* add os to $nu based on rust's understanding

* add a few more constants
2022-04-19 14:11:58 -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
Sygmei
e206555d9d
add custom_completion field to .scope command (#5227) 2022-04-19 10:02:03 +12:00
Kat Marchán
1314a87cb0
update miette and switch to GenericErrors (#5222) 2022-04-19 00:34:10 +12:00
JT
5bf1c98a39
Move to dev version 0.61.1 (#5206) 2022-04-16 09:29:30 +12:00
JT
4566c904d0
Bump 0.61 (#5166) 2022-04-13 05:42:26 +12:00
Reilly Wood
57761149f4
Update incorrect crate descriptions (#5159) 2022-04-12 06:17:06 +12:00
JT
14066ccc30
Fix known externals, fix operator spans (#5140) 2022-04-09 17:17:48 +12: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
Michel Alexandre Salim
6ed033737d
Include license text in all crates (#5094)
* Include license text in all crates

Three crates already have license texts, so I'm keeping them, but
symlinking the `LICENSE` from the top level to the rest of the crate
directories. This works as long as `cargo publish` is done on a Unix-y
system and not Windows.

Also bump the copyright year to end in 2022.

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>

* Replace symlinks

Co-authored-by: sholderbach <sholderbach@users.noreply.github.com>
2022-04-08 10:47:13 +02:00
Reilly Wood
b2c52b51b7
Change string contains operators to regex (#5117) 2022-04-07 18:23:14 +12:00
JT
591fb4bd36
Add unary not (#5111) 2022-04-07 07:10:25 +12:00
Jakub Žádník
12d3e4e424
Add env.nu file for environment config (#5099)
* Add env.nu file for environment config

* Add missing flag

* Add $nu.env-path variable

Prints `env.nu` path

* Add example of adding entries to PATH
2022-04-07 05:11:51 +12:00
Darren Schroeder
2cb815b7b4
Add starts with operator (#5061)
* add starts_with operator

* added a test
2022-04-01 13:35:46 -05:00
Jakub Žádník
2873e943b3
Add search terms to Command and Signature (#4980)
* Add search terms to command

* Rename Signature desc to usage

To be named uniformly with extra_usage

* Throw in foldl search term for reduce

* Add missing usage to post

* Add search terms to signature

* Try to add capnp Signature serialization
2022-03-27 22:25:30 +03:00
JT
82e3bb0f38
Bump nushell to 0.60.1 (#4987) 2022-03-27 16:18:47 +13:00
Jakub Žádník
3484e0defd
Add parser keyword note to help and $nu.scope (#4978) 2022-03-26 21:22:45 +02:00
Jakub Žádník
79e4d35f01
Remove is_private from $nu.scope.commands (#4979) 2022-03-26 21:22:35 +02:00
JT
ec5fd62f9f
Add licenses (#4893)
* Add licenses

* Add licenses
2022-03-23 09:25:38 +13:00
JT
1c964cdfe7
Bump to 0.60 (#4892)
* WIP

* semi-revert metadata change
2022-03-23 07:32:03 +13:00
Darren Schroeder
285f91e67a
add module name to $nu.scope.commands info (#4877) 2022-03-19 10:58:56 -05:00
Darren Schroeder
01c1e5e8b0
commands are either custom or builtin, not both (#4876)
* commands are either custom or builtin, not both

* clippy
2022-03-19 09:52:50 -05:00
Jakub Žádník
72daf8c64e
Fix reporting of which and $nu.scope (#4836)
* Refactor & fix which

Instead of fetching all definitions / aliases, only show the one that is
visible.

* Fix $nu.scope to show only visible definitions

* Add missing tests file; Rename one which test
2022-03-13 21:32:46 +02:00
JT
ff3dffd813
Nu glob (#4818)
* Fork glob. Normalise license holder

* Fix more licenses

* unwraps

* bad doc test
2022-03-13 11:30:27 -07:00
Darren Schroeder
0ff9cc679e
add $nu.pid (#4828) 2022-03-12 10:54:59 -06:00
Darren Schroeder
ccc85a2979
remove $nu.cwd (#4824) 2022-03-12 09:11:19 -06:00
Jakub Žádník
90b2ec537f
Do not pass non-string env vars to externals (#4748)
* Do not pass non-string env vars to externals

Also misc cleanup

* Add note to default config

* Add a test

* Ensure PATH/Path conversion list <-> string
2022-03-12 00:18:39 +02:00
JT
12bf23faa6
Move completions to DeclId (#4801)
* Move completions to DeclId

* fmt

* fmt
2022-03-10 09:49:02 +02:00
JT
2ac990655e
Add support for var decl spans (#4787) 2022-03-09 04:42:19 -05:00
JT
1837bf775c
Default values (#4770) 2022-03-07 15:08:56 -05:00
JT
0b6b321ad6
More nuon tests, fix table print (#4762) 2022-03-07 08:39:02 -05:00
JT
9c17c73d5f
Add more exit code support (#4730) 2022-03-04 17:46:18 -05:00
JT
e64ca97fe2
move scope variable into nu variable (#4725) 2022-03-04 11:36:11 -05:00
Jakub Žádník
d90b7953dd
Use Nushell's PATH in which (#4690)
* Make which use our path instead of std::env

* Unignore which test

* Fix wrong fn signature without which feature
2022-03-03 10:38:31 +02:00
JT
88d7b50e37
Pass redirects into call (#4694)
* Pass redirects into call

* Oops, format
2022-03-02 07:52:24 -05:00
JT
4965f4cbf4
Bump to 0.59.1 (#4689) 2022-03-01 16:55:51 -05:00
JT
a6a96b29cb
Add binary literals (#4680) 2022-02-28 18:31:53 -05:00
JT
7819210037
Add shortcircuiting boolean operators (#4668) 2022-02-27 17:02:53 -05:00
JT
4b18fdcc6e
Date literals (#4619)
* Date literals

* update deps

* Add date+duration
2022-02-23 21:02:48 -05:00
JT
676457acd3
Better ls paths (#4612)
* Fix ls paths... again

* Fix ls paths... again

* Always expand paths inside of glob_from

* Expand in ls before we check for directory info
2022-02-23 10:54:47 -05:00
JT
9888f8f298
Add pipeline redirection support (#4594)
* redirection

* Remove commented-out

* fix tests

* more fixes
2022-02-21 17:22:21 -05:00
JT
2ba12afb01
A few fixes to docs generation and default config (#4570)
* A few fixes to docs generation and default config

* A few more fixes
2022-02-20 15:20:41 -05:00
Jakub Žádník
56aacc4852
Use environment variable for env_conversions (#4566)
* Handle string->value env conv. with env. var.

Also adds the environment variable for Path/PATH and removes it from
config.

* Simplify getting the string->value conversion

* Refactor env conversion into its own function

* Use env var for to_string conversion; Remove conf

* Fix indentation in default config
2022-02-20 16:27:59 +02:00
JT
a32ce93c79
Improve full help for flags (#4559) 2022-02-19 21:25:52 -05:00
Darren Schroeder
9415352447
remove $nu.keybinding-path (#4515) 2022-02-17 14:36:08 -05:00
JT
f5f9d56c37
Move to a standard kebab/snake style (#4509) 2022-02-17 09:55:17 -05:00
JT
56b3fc61a3
Remove statements, replaced by pipelines (#4482) 2022-02-15 14:31:14 -05:00
JT
8c0a2d3c15
Auto-generate markdown command docs (#4451)
* Finish updating

* a couple improvements

* Update renames

* cleanup examples
2022-02-13 21:22:51 -05:00
Jakub Žádník
328f7e92a0
Hide alias (#4432)
* Add alias interning

Now, AliasId is used to reference aliases stored in EngineState, similar
to decls, blocks, etc.

* Fix wrong message

* Fix using decl instead of alias

* Extend also alias id visibility

* Merge also aliases from delta

* Add alias hiding code

Does not work yet but passes tests at least.

* Fix wrong alias lookup and visibility appending

* Add hide alias tests

* Fmt & Clippy

* Fix random clippy warnings in "which" command
2022-02-12 11:50:37 +02:00
JT
a16e485cce
Add support for defining known externals with their own custom completions (#4425)
* WIP for known externals

* Now completions can work from scripts

* Add support for definiing externs

* finish cleaning up old proof-of-concept
2022-02-11 13:38:10 -05:00
JT
c2118e7505
Fix help flag (#4398)
* Match 'help command' to 'command --help'

* Fix tests
2022-02-09 21:24:29 -05:00
JT
d70d91e559 Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00
Fernando Herrera
fdce6c49ab engine-q merge 2022-02-07 19:11:34 +00:00
JT
a911b21256
Switch more commands to redirecting blocks (#956) 2022-02-05 21:03:06 -05:00
Jakub Žádník
fefd5fef12
Allow def-env to hide environment variables (#921) 2022-02-04 20:02:03 +02:00
JT
a008f1aa80
Command tests (#922)
* WIP command tests

* Finish marking todo tests

* update

* update

* Windows cd test ignoring
2022-02-03 21:01:45 -05:00