Commit Graph

144 Commits

Author SHA1 Message Date
Andrés N. Robalino
837d12decd Filesystem shell can't cd into files. Ever. 2019-09-24 15:34:30 -05:00
Jonathan Turner
5ff94004c6 Add urlencode/urldecode 2019-09-19 16:25:29 +12:00
Andrés N. Robalino
91bea7fb2a
Assert the column is unknown.
did you mean in error messages appear when `get`ing unknown columns. Here we know the column does not exist so we check the exact error message.
2019-09-14 14:53:31 -05:00
Yehuda Katz
19767ad551 Taking another stab at replacing Span with Tag 2019-09-14 11:48:45 -05:00
Jonathan Turner
074a76c9d4 Fix test 2019-09-13 15:48:32 +12:00
Andrés N. Robalino
7838dac689 first and get coverage. 2019-09-12 05:22:58 -05:00
Andrés N. Robalino
c57c0eb371 pass lint checks. 2019-09-12 01:49:01 -05:00
Andrés N. Robalino
b35549adac Removes regex crate dependency. 2019-09-11 22:20:42 -05:00
Maximilian Roos
127381497c
run rustfmt 2019-09-11 10:36:50 -04:00
Andrés N. Robalino
ba8383ae2f to-[csv/tsv] fixes. 2019-09-10 07:00:25 -05:00
Andrés N. Robalino
f61144006f config test harness. 2019-09-10 05:08:01 -05:00
Andrés N. Robalino
f770409a60 cd '-' valueshell implementation and valueshell refactorings. 2019-09-08 05:40:47 -05:00
Andrés N. Robalino
77c2e4200e Filesystem cd refactor/cleanup. 2019-09-08 04:55:49 -05:00
Andrés N. Robalino
df9ff44956 Filesystem change directory coverage. 2019-09-08 03:09:05 -05:00
Andrés N. Robalino
eecda3ecba
Merge pull request #363 from twe4ked/cd-back
Implement `cd -` to return to the previous directory
2019-09-08 01:00:32 -05:00
Odin Dutton
159cf27e39 Implement cd - to return to the last path for the FilesystemShell 2019-09-08 15:10:46 +10:00
Jonathan Turner
9da896ad4e Attempt so simplify classified 2019-09-08 14:00:04 +12:00
Jonathan Turner
84628f298d Finish fixing failing tests. 2019-09-08 13:35:02 +12:00
Patrick Meredith
39fce1191f Fix typo 2019-09-04 13:38:17 -04:00
Patrick Meredith
e8764911cb Add comments for sample.{bson,db} 2019-09-04 13:36:12 -04:00
Jonathan Turner
479f0a566e Covert to_* commands to work on whole table 2019-09-04 18:48:40 +12:00
Patrick Meredith
05e858fa94 Add test 2019-09-03 22:37:26 -04:00
est31
cf0efb811e Trim trailing whitespace and set it in editorconfig 2019-09-03 02:52:52 +02:00
Andrés N. Robalino
9488c41dcd can embed a new field to the table 2019-09-02 00:37:13 -05:00
Andrés N. Robalino
ca0c6eaf58 This commit introduces a basic help feature. We can go to it
with the `help` command to explore and list all commands available.

Enter will also try to see if the location to be entered is an existing
Nu command, if it is it will let you inspect the command under `help`.

This provides baseline needed so we can iterate on it.
2019-08-31 19:06:11 -05:00
Patrick Meredith
b514d93ffd Add Decimal to sample.bson 2019-08-31 19:15:48 +02:00
Patrick Meredith
3d147d1143 Add SQLite support 2019-08-30 20:54:45 -04:00
Andrés N. Robalino
f1e8c433c2 [from/to]tsv support. 2019-08-29 04:02:16 -05:00
Andrés N. Robalino
9810df25b4 Readability improvement. 2019-08-29 01:31:56 -05:00
Andrés N. Robalino
4d2b0f43f5 Fix test. 2019-08-28 21:05:23 -05:00
Andrés N. Robalino
a07817e0e0 cover pipeline helper. 2019-08-28 20:30:51 -05:00
Andrés N. Robalino
55fb1f8dda Yo quiero Playground taconushell. 2019-08-28 19:32:42 -05:00
Yehuda Katz
f82cc4291f Migrate commands_test 2019-08-28 10:58:00 -07:00
Yehuda Katz
abac7cf746 Migrate rm 2019-08-28 10:48:52 -07:00
Yehuda Katz
2c65b2fc2f Migrate mv 2019-08-28 10:28:58 -07:00
Yehuda Katz
21ad06b1e1 Remove unwraps and clean up playground
The original intent of this patch was to remove more unwraps to reduce
panics. I then lost a ton of time to the fact that the playground isn't
in a temp directory (because of permissions issues on Windows).

This commit improves the test facilities to:

- use a tempdir for the playground
- change the playground API so you instantiate it with a block that
  encloses the lifetime of the tempdir
- the block is called with a `dirs` argument that has `dirs.test()` and
  other important directories that we were computing by hand all the time
- the block is also called with a `playground` argument that you can use
  to construct files (it's the same `Playground` as before)
- change the nu! and nu_error! macros to produce output instead of
  taking a variable binding
- change the nu! and nu_error! macros to do the cwd() transformation
  internally
- change the nu! and nu_error! macros to take varargs at the end that
  get interpolated into the running command

I didn't manage to finish porting all of the tests, so a bunch of tests
are currently commented out. That will need to change before we land
this patch.
2019-08-28 10:01:16 -07:00
Andrés N. Robalino
162c8b4274 swept clean quotes 2019-08-27 06:20:22 -05:00
Andrés N. Robalino
b502954558 [from|to]json additions/refactoring. 2019-08-27 06:05:51 -05:00
Jonathan Turner
3750a04cfc
Merge branch 'master' into expand-tilde 2019-08-27 16:23:56 +12:00
Yehuda Katz
34292b282a Add support for ~ expansion
This ended up being a bit of a yak shave. The basic idea in this commit is to
expand `~` in paths, but only in paths.

The way this is accomplished is by doing the expansion inside of the code that
parses literal syntax for `SyntaxType::Path`.

As a quick refresher: every command is entitled to expand its arguments in a
custom way. While this could in theory be used for general-purpose macros,
today the expansion facility is limited to syntactic hints.

For example, the syntax `where cpu > 0` expands under the hood to
`where { $it.cpu > 0 }`. This happens because the first argument to `where`
is defined as a `SyntaxType::Block`, and the parser coerces binary expressions
whose left-hand-side looks like a member into a block when the command is
expecting one.

This is mildly more magical than what most programming languages would do,
but we believe that it makes sense to allow commands to fine-tune the syntax
because of the domain nushell is in (command-line shells).

The syntactic expansions supported by this facility are relatively limited.
For example, we don't allow `$it` to become a bare word, simply because the
command asks for a string in the relevant position. That would quickly
become more confusing than it's worth.

This PR adds a new `SyntaxType` rule: `SyntaxType::Path`. When a command
declares a parameter as a `SyntaxType::Path`, string literals and bare
words passed as an argument to that parameter are processed using the
path expansion rules. Right now, that only means that `~` is expanded into
the home directory, but additional rules are possible in the future.

By restricting this expansion to a syntactic expansion when passed as an
argument to a command expecting a path, we avoid making `~` a generally
reserved character. This will also allow us to give good tab completion
for paths with `~` characters in them when a command is expecting a path.

In order to accomplish the above, this commit changes the parsing functions
to take a `Context` instead of just a `CommandRegistry`. From the perspective
of macro expansion, you can think of the `CommandRegistry` as a dictionary
of in-scope macros, and the `Context` as the compile-time state used in
expansion. This could gain additional functionality over time as we find
more uses for the expansion system.
2019-08-26 21:03:24 -07:00
Patrick Meredith
738675259e Improve test so that it should work on Windows 2019-08-26 21:26:49 -04:00
Patrick Meredith
87a99bbabf Implement to-bson 2019-08-26 20:07:59 -04:00
Dirkjan Ochtman
b77effa434 Fix formatting with cargo fmt 2019-08-26 20:19:05 +02:00
Andrés N. Robalino
8940e57cf3 mark #[test] back. (deleted and reverting it from.. 12e38063) 2019-08-25 21:50:55 -05:00
Andrés N. Robalino
12e3806349
Merge pull request #415 from androbtech/fromto-refact
[from|to]csv additions/refactoring.
2019-08-25 12:56:28 -05:00
Jonathan Turner
dda4a707a7
Merge pull request #421 from ramonsnir/reverse
add reverse
2019-08-26 05:41:07 +12:00
Andrés N. Robalino
0e14ba86ae [from|to]csv additions/refactoring.
Introduced flag to tell `from-to` / `to-csv` whether we want headers parsed and/or written.
2019-08-25 12:32:08 -05:00
Patrick Meredith
3c89cb7e98 Remove test that refuses to pass on Windows (it's just a minor formatting issue) 2019-08-25 12:25:40 -04:00
Ramon Snir
9735c3fcea
add reverse 2019-08-25 12:14:17 -04:00
Patrick Meredith
376809aa2a Normalize strings for bson tests 2019-08-25 11:43:15 -04:00