Commit Graph

1584 Commits

Author SHA1 Message Date
Thomas Hartmann
d2eb6f6646 Adds .envrc and shell.nix 2019-10-10 21:23:12 +02:00
Yehuda Katz
1ad9d6f199 Overhaul the expansion system
The main thrust of this (very large) commit is an overhaul of the
expansion system.

The parsing pipeline is:

- Lightly parse the source file for atoms, basic delimiters and pipeline
  structure into a token tree
- Expand the token tree into a HIR (high-level intermediate
  representation) based upon the baseline syntax rules for expressions
  and the syntactic shape of commands.

Somewhat non-traditionally, nu doesn't have an AST at all. It goes
directly from the token tree, which doesn't represent many important
distinctions (like the difference between `hello` and `5KB`) directly
into a high-level representation that doesn't have a direct
correspondence to the source code.

At a high level, nu commands work like macros, in the sense that the
syntactic shape of the invocation of a command depends on the
definition of a command.

However, commands do not have the ability to perform unrestricted
expansions of the token tree. Instead, they describe their arguments in
terms of syntactic shapes, and the expander expands the token tree into
HIR based upon that definition.

For example, the `where` command says that it takes a block as its first
required argument, and the description of the block syntactic shape
expands the syntax `cpu > 10` into HIR that represents
`{ $it.cpu > 10 }`.

This commit overhauls that system so that the syntactic shapes are
described in terms of a few new traits (`ExpandSyntax` and
`ExpandExpression` are the primary ones) that are more composable than
the previous system.

The first big win of this new system is the addition of the `ColumnPath`
shape, which looks like `cpu."max ghz"` or `package.version`.
Previously, while a variable path could look like `$it.cpu."max ghz"`,
the tail of a variable path could not be easily reused in other
contexts. Now, that tail is its own syntactic shape, and it can be used
as part of a command's signature.

This cleans up commands like `inc`, `add` and `edit` as well as
shorthand blocks, which can now look like `| where cpu."max ghz" > 10`
2019-10-10 08:27:51 -07:00
Fahmi Akbar Wildana
3e14de158b
fix(ci): can't push to quay.io (#1)
* ci(github): lowercase ${{ github.actor }}

* ci(github): fix robot username

* fix(ci): fix tag name on suffixed version
2019-10-09 09:58:49 +07:00
Andrés N. Robalino
e18892000a
Merge pull request #802 from twe4ked/improve-cd-docs
Improve cd docs
2019-10-08 20:20:28 -05:00
Odin Dutton
4d70255696 Add documentation for cd - 2019-10-08 18:32:42 +11:00
Odin Dutton
77c34acb03 Whitespace 2019-10-08 18:32:42 +11:00
Odin Dutton
e72bc8ea8b Remove unneeded - 2019-10-08 18:32:39 +11:00
Jonathan Turner
a882e640e4
Merge pull request #793 from chhetripradeep/pchhetri/enter
Add documentation for the enter command
2019-10-08 06:02:49 +13:00
Pradeep Chhetri
c09d866a77 Add documentation for the enter command 2019-10-07 23:21:58 +08:00
Jonathan Turner
4467e59122
Merge pull request #792 from chhetripradeep/pchhetri/open
Add documentation for the open command
2019-10-07 11:17:28 +11:00
Jonathan Turner
9c096d320a
Merge pull request #797 from chhetripradeep/pchhetri/fetch
Add documentation for the fetch command
2019-10-07 11:16:36 +11:00
Fahmi Akbar Wildana
93ae5043cc
ci(github): change REGISTRY to quay.io 2019-10-07 03:53:07 +07:00
Fahmi Akbar Wildana
b134394319
ci(github): refactor docker related run scripts 2019-10-07 03:14:51 +07:00
Fahmi Akbar Wildana
b163775112
ci(github): install cross from release page
Instead of compiling `cross` via `cargo install`,
downloading binary executable from release page will speedup the CI
2019-10-07 02:53:23 +07:00
Fahmi Akbar Wildana
8bd035f51d
ci(github): renew trigger definition
There is an update in workflow syntax docs
https://help.github.com/en/articles/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
2019-10-07 02:51:35 +07:00
Pradeep Chhetri
9f15017032 Add documentation for the fetch command 2019-10-07 02:17:57 +08:00
Pradeep Chhetri
81fec11f88 Add documentation for the open command 2019-10-07 02:08:20 +08:00
Jonathan Turner
8a6a688131
Merge pull request #795 from chhetripradeep/pchhetri/inc
Add documentation for the inc command
2019-10-07 04:35:08 +11:00
Jonathan Turner
77a4de31fa
Merge pull request #794 from chhetripradeep/pchhetri/sys
Add documentation for the sys command
2019-10-07 04:33:51 +11:00
Jonathan Turner
09e88d127e
Merge pull request #791 from chhetripradeep/pchhetri/trim
Add documentation for the trim command
2019-10-07 04:30:52 +11:00
Pradeep Chhetri
7ff5734d5d Add documentation for the inc command 2019-10-06 23:30:52 +08:00
Pradeep Chhetri
1d19595996 Add documentation for the sys command 2019-10-06 23:20:48 +08:00
Pradeep Chhetri
7d115da782 Add documentation for the trim command 2019-10-06 22:35:38 +08:00
Andrés N. Robalino
b066775630
Merge pull request #789 from cristicismas/patch-1
Update cd.md to look better
2019-10-04 16:24:42 -05:00
Andrés N. Robalino
8bb6bcb6eb
Merge pull request #790 from mfarberbrodsky/add-nth-docs
Add documentation for nth command
2019-10-04 16:24:06 -05:00
Maya Farber Brodsky
20031861b9 Add documentation for nth command 2019-10-04 17:37:11 +03:00
Cristi Cismas
eb297d3b8f
Update cd.md to look better 2019-10-04 15:10:46 +03:00
Andrés N. Robalino
8faa0126eb
Merge pull request #784 from coolshaurya/to-dash-sth-docs
Added docs for most of the to-sth commands
2019-10-03 21:47:00 -05:00
Shaurya Shubham
6aec03708f Fix minor typo 2019-10-04 06:44:45 +05:30
Shaurya Shubham
2f7b1e4282 Added improvements suggested by @andrasio
Added `open file.sth | to-sth` type examples
Also did a format conversion example with `open jonathon.xml | to-json` in to-json.md
2019-10-04 06:40:16 +05:30
Andrés N. Robalino
7492131142
Merge pull request #770 from rnxpyke/master
add regex match plugin
2019-10-03 14:20:41 -05:00
Andrés N. Robalino
3c6ee63e59
Merge pull request #777 from JonnyWalker81/fix-get-panic
Attempt at fixing `get` command panic.
2019-10-03 14:02:51 -05:00
Andrés N. Robalino
45ad18f654
Merge pull request #785 from Charles-Schleich/master
Created Docs for env command
2019-10-03 14:00:51 -05:00
Andrés N. Robalino
01829f04d5
Merge pull request #783 from notryanb/document-last
add documentation for the last command
2019-10-03 13:59:41 -05:00
Andrés N. Robalino
cc1c471877
Merge pull request #779 from pema99/lines-doc
Add documentation for lines
2019-10-03 13:58:30 -05:00
Andrés N. Robalino
de14f9fce8
Merge pull request #781 from coolshaurya/add-command-docs
Create docs for add command
2019-10-03 13:38:11 -05:00
Andrés N. Robalino
6c3ed1dbc2
Merge pull request #782 from coolshaurya/docs-edit-command
Create docs for edit command
2019-10-03 13:37:49 -05:00
Charles Schleich
cf0fa3141a Created Docs for env command 2019-10-03 20:13:22 +02:00
Shaurya Shubham
539e232f3c Added docs for most of the to-sth commands
Partial fix of issue #711
Docs for the following commands were added -
to-csv
to-json
to-toml
to-tsv
to-url
to-yaml

Docs for to-db , to-bson , to-sqlite have not been added as I don't recognize and understand those formats.
2019-10-03 19:07:48 +05:30
Ryan Blecher
9ed889ccbb fix grammar 2019-10-03 08:18:51 -04:00
Ryan Blecher
872e26b524 add documentation for the last command 2019-10-03 08:14:59 -04:00
Shaurya Shubham
5bfff0c39b
Create docs for edit command
Partial fix of issue #711
2019-10-03 16:54:28 +05:30
Shaurya Shubham
0505a9d6f7
Create docs for add command
Partial fix of issue #711
2019-10-03 16:27:04 +05:30
rnxypke
9181a046ec use correct argument for error message 2019-10-03 08:21:24 +02:00
pema99
1b0eaac470 Add documentation for lines 2019-10-03 06:09:01 +02:00
Jonathan Rothberg
e54cd98a9c Put code into None case of last match. 2019-10-02 20:41:53 -07:00
Jonathan Rothberg
f3eb4fb24e Attempt at fixing get command panic.
If possible matches are not found then check if the passed in `obj`
parameter is a `string` or a `path`, if so then return it.  I am not
sure this is the right fix, but I figured I would make an attempt and
get a conversation started about it.
2019-10-02 20:16:27 -07:00
Jonathan Turner
04854d5d99
Merge pull request #776 from gilesv/where-command
Create where.md
2019-10-03 15:38:59 +13:00
Jonathan Turner
124a814f4d
Merge pull request #775 from JonnyWalker81/vi-textview-scroll
Added Vi support for scrolling in the textview command.
2019-10-03 15:19:11 +13:00
gilesv
2e1670fcb8 Add documentation for where command 2019-10-02 22:49:05 -03:00