From b2c5af457e262df97e9c7e1006a1dd427dfc1b56 Mon Sep 17 00:00:00 2001 From: Jason Gedge Date: Wed, 4 Mar 2020 13:58:20 -0500 Subject: [PATCH] Move most of the root package into a subcrate. (#1445) This improves incremental build time when working on what was previously the root package. For example, previously all plugins would be rebuilt with a change to `src/commands/classified/external.rs`, but now only `nu-cli` will have to be rebuilt (and anything that depends on it). --- .dockerignore | 1 + .gitignore | 1 + Cargo.lock | 85 +++++++---- Cargo.toml | 134 +++--------------- crates/nu-cli/Cargo.toml | 99 +++++++++++++ {src => crates/nu-cli/src}/cli.rs | 31 +--- {src => crates/nu-cli/src}/commands.rs | 0 {src => crates/nu-cli/src}/commands/append.rs | 0 {src => crates/nu-cli/src}/commands/args.rs | 0 .../nu-cli/src}/commands/autoview.rs | 0 {src => crates/nu-cli/src}/commands/calc.rs | 0 {src => crates/nu-cli/src}/commands/cd.rs | 0 .../src}/commands/classified/dynamic.rs | 0 .../src}/commands/classified/external.rs | 0 .../src}/commands/classified/internal.rs | 0 .../nu-cli/src}/commands/classified/mod.rs | 0 .../src}/commands/classified/pipeline.rs | 0 {src => crates/nu-cli/src}/commands/clear.rs | 0 {src => crates/nu-cli/src}/commands/clip.rs | 0 .../nu-cli/src}/commands/command.rs | 0 .../nu-cli/src}/commands/compact.rs | 0 {src => crates/nu-cli/src}/commands/config.rs | 0 {src => crates/nu-cli/src}/commands/count.rs | 0 {src => crates/nu-cli/src}/commands/cp.rs | 0 {src => crates/nu-cli/src}/commands/date.rs | 0 {src => crates/nu-cli/src}/commands/debug.rs | 0 .../nu-cli/src}/commands/default.rs | 0 {src => crates/nu-cli/src}/commands/du.rs | 0 {src => crates/nu-cli/src}/commands/echo.rs | 0 {src => crates/nu-cli/src}/commands/edit.rs | 0 {src => crates/nu-cli/src}/commands/enter.rs | 0 {src => crates/nu-cli/src}/commands/env.rs | 0 .../nu-cli/src}/commands/evaluate_by.rs | 0 {src => crates/nu-cli/src}/commands/exit.rs | 0 {src => crates/nu-cli/src}/commands/first.rs | 0 {src => crates/nu-cli/src}/commands/format.rs | 0 .../nu-cli/src}/commands/from_bson.rs | 0 .../nu-cli/src}/commands/from_csv.rs | 0 .../src}/commands/from_delimited_data.rs | 0 .../nu-cli/src}/commands/from_ini.rs | 0 .../nu-cli/src}/commands/from_json.rs | 0 .../nu-cli/src}/commands/from_ods.rs | 0 .../nu-cli/src}/commands/from_sqlite.rs | 0 .../nu-cli/src}/commands/from_ssv.rs | 0 .../nu-cli/src}/commands/from_toml.rs | 0 .../nu-cli/src}/commands/from_tsv.rs | 0 .../nu-cli/src}/commands/from_url.rs | 0 .../nu-cli/src}/commands/from_xlsx.rs | 0 .../nu-cli/src}/commands/from_xml.rs | 0 .../nu-cli/src}/commands/from_yaml.rs | 0 {src => crates/nu-cli/src}/commands/get.rs | 0 .../nu-cli/src}/commands/group_by.rs | 0 {src => crates/nu-cli/src}/commands/help.rs | 0 .../nu-cli/src}/commands/histogram.rs | 0 .../nu-cli/src}/commands/history.rs | 0 {src => crates/nu-cli/src}/commands/insert.rs | 0 {src => crates/nu-cli/src}/commands/kill.rs | 0 {src => crates/nu-cli/src}/commands/last.rs | 0 {src => crates/nu-cli/src}/commands/lines.rs | 0 {src => crates/nu-cli/src}/commands/ls.rs | 0 {src => crates/nu-cli/src}/commands/macros.rs | 0 .../nu-cli/src}/commands/map_max_by.rs | 0 {src => crates/nu-cli/src}/commands/mkdir.rs | 0 {src => crates/nu-cli/src}/commands/mv.rs | 0 {src => crates/nu-cli/src}/commands/next.rs | 0 {src => crates/nu-cli/src}/commands/nth.rs | 0 {src => crates/nu-cli/src}/commands/open.rs | 0 {src => crates/nu-cli/src}/commands/parse.rs | 0 {src => crates/nu-cli/src}/commands/pick.rs | 0 {src => crates/nu-cli/src}/commands/pivot.rs | 0 {src => crates/nu-cli/src}/commands/plugin.rs | 0 .../nu-cli/src}/commands/prepend.rs | 0 {src => crates/nu-cli/src}/commands/prev.rs | 0 {src => crates/nu-cli/src}/commands/pwd.rs | 0 {src => crates/nu-cli/src}/commands/range.rs | 0 .../nu-cli/src}/commands/reduce_by.rs | 0 {src => crates/nu-cli/src}/commands/reject.rs | 0 {src => crates/nu-cli/src}/commands/rename.rs | 0 .../nu-cli/src}/commands/reverse.rs | 0 {src => crates/nu-cli/src}/commands/rm.rs | 0 {src => crates/nu-cli/src}/commands/save.rs | 0 {src => crates/nu-cli/src}/commands/shells.rs | 0 {src => crates/nu-cli/src}/commands/size.rs | 0 {src => crates/nu-cli/src}/commands/skip.rs | 0 .../nu-cli/src}/commands/skip_while.rs | 0 .../nu-cli/src}/commands/sort_by.rs | 0 .../nu-cli/src}/commands/split_by.rs | 0 .../nu-cli/src}/commands/split_column.rs | 0 .../nu-cli/src}/commands/split_row.rs | 0 .../nu-cli/src}/commands/t_sort_by.rs | 0 {src => crates/nu-cli/src}/commands/table.rs | 0 {src => crates/nu-cli/src}/commands/tags.rs | 0 .../nu-cli/src}/commands/to_bson.rs | 0 {src => crates/nu-cli/src}/commands/to_csv.rs | 0 .../nu-cli/src}/commands/to_delimited_data.rs | 0 .../nu-cli/src}/commands/to_json.rs | 0 .../nu-cli/src}/commands/to_sqlite.rs | 0 .../nu-cli/src}/commands/to_toml.rs | 0 {src => crates/nu-cli/src}/commands/to_tsv.rs | 0 {src => crates/nu-cli/src}/commands/to_url.rs | 0 .../nu-cli/src}/commands/to_yaml.rs | 0 {src => crates/nu-cli/src}/commands/touch.rs | 0 {src => crates/nu-cli/src}/commands/trim.rs | 0 {src => crates/nu-cli/src}/commands/uniq.rs | 0 .../nu-cli/src}/commands/version.rs | 0 {src => crates/nu-cli/src}/commands/what.rs | 0 {src => crates/nu-cli/src}/commands/where_.rs | 0 {src => crates/nu-cli/src}/commands/which_.rs | 0 {src => crates/nu-cli/src}/commands/wrap.rs | 0 {src => crates/nu-cli/src}/context.rs | 0 {src => crates/nu-cli/src}/data.rs | 0 {src => crates/nu-cli/src}/data/base.rs | 0 {src => crates/nu-cli/src}/data/base/shape.rs | 0 {src => crates/nu-cli/src}/data/command.rs | 0 {src => crates/nu-cli/src}/data/config.rs | 0 .../nu-cli/src}/data/config/conf.rs | 0 .../nu-cli/src}/data/config/nuconfig.rs | 0 .../nu-cli/src}/data/config/tests.rs | 0 {src => crates/nu-cli/src}/data/dict.rs | 0 {src => crates/nu-cli/src}/data/files.rs | 0 {src => crates/nu-cli/src}/data/operators.rs | 0 {src => crates/nu-cli/src}/data/primitive.rs | 0 {src => crates/nu-cli/src}/data/process.rs | 0 {src => crates/nu-cli/src}/data/types.rs | 0 {src => crates/nu-cli/src}/data/value.rs | 0 {src => crates/nu-cli/src}/deserializer.rs | 0 {src => crates/nu-cli/src}/env.rs | 0 {src => crates/nu-cli/src}/env/environment.rs | 0 .../nu-cli/src}/env/environment_syncer.rs | 0 {src => crates/nu-cli/src}/env/host.rs | 0 .../nu-cli/src}/evaluate/evaluate_args.rs | 0 .../nu-cli/src}/evaluate/evaluator.rs | 0 {src => crates/nu-cli/src}/evaluate/mod.rs | 0 .../nu-cli/src}/evaluate/operator.rs | 0 .../nu-cli/src}/evaluate/variables.rs | 0 {src => crates/nu-cli/src}/format.rs | 0 {src => crates/nu-cli/src}/format/entries.rs | 0 {src => crates/nu-cli/src}/format/generic.rs | 0 {src => crates/nu-cli/src}/format/list.rs | 0 {src => crates/nu-cli/src}/format/table.rs | 0 {src => crates/nu-cli/src}/futures.rs | 0 {src => crates/nu-cli/src}/git.rs | 0 {src => crates/nu-cli/src}/lib.rs | 0 {src => crates/nu-cli/src}/prelude.rs | 0 {src => crates/nu-cli/src}/shell.rs | 0 {src => crates/nu-cli/src}/shell/completer.rs | 0 .../nu-cli/src}/shell/filesystem_shell.rs | 0 .../nu-cli/src}/shell/help_shell.rs | 0 {src => crates/nu-cli/src}/shell/helper.rs | 0 {src => crates/nu-cli/src}/shell/shell.rs | 0 .../nu-cli/src}/shell/shell_manager.rs | 0 .../nu-cli/src}/shell/value_shell.rs | 0 {src => crates/nu-cli/src}/stream.rs | 0 {src => crates/nu-cli/src}/utils.rs | 9 +- .../nu-cli/src}/utils/data_processing.rs | 0 .../nu-cli/tests}/commands/append.rs | 0 .../nu-cli/tests}/commands/calc.rs | 0 {tests => crates/nu-cli/tests}/commands/cd.rs | 0 .../nu-cli/tests}/commands/compact.rs | 0 {tests => crates/nu-cli/tests}/commands/cp.rs | 0 .../nu-cli/tests}/commands/default.rs | 0 .../nu-cli/tests}/commands/edit.rs | 0 .../nu-cli/tests}/commands/enter.rs | 0 .../nu-cli/tests}/commands/first.rs | 0 .../nu-cli/tests}/commands/format.rs | 0 .../nu-cli/tests}/commands/get.rs | 0 .../nu-cli/tests}/commands/group_by.rs | 0 .../nu-cli/tests}/commands/histogram.rs | 0 .../nu-cli/tests}/commands/insert.rs | 0 .../nu-cli/tests}/commands/last.rs | 0 .../nu-cli/tests}/commands/lines.rs | 0 {tests => crates/nu-cli/tests}/commands/ls.rs | 0 .../nu-cli/tests}/commands/mkdir.rs | 0 .../nu-cli/tests}/commands/mod.rs | 0 {tests => crates/nu-cli/tests}/commands/mv.rs | 0 .../nu-cli/tests}/commands/nth.rs | 0 .../nu-cli/tests}/commands/open.rs | 0 .../nu-cli/tests}/commands/parse.rs | 0 .../nu-cli/tests}/commands/pick.rs | 0 .../nu-cli/tests}/commands/prepend.rs | 0 .../nu-cli/tests}/commands/range.rs | 0 .../nu-cli/tests}/commands/rename.rs | 0 .../nu-cli/tests}/commands/reverse.rs | 0 {tests => crates/nu-cli/tests}/commands/rm.rs | 0 .../nu-cli/tests}/commands/save.rs | 0 .../nu-cli/tests}/commands/sort_by.rs | 0 .../nu-cli/tests}/commands/split_by.rs | 0 .../nu-cli/tests}/commands/split_column.rs | 0 .../nu-cli/tests}/commands/touch.rs | 0 .../nu-cli/tests}/commands/uniq.rs | 0 .../nu-cli/tests}/commands/where_.rs | 0 .../nu-cli/tests}/commands/wrap.rs | 0 .../nu-cli/tests}/format_conversions/bson.rs | 0 .../nu-cli/tests}/format_conversions/csv.rs | 0 .../nu-cli/tests}/format_conversions/json.rs | 0 .../nu-cli/tests}/format_conversions/mod.rs | 0 .../nu-cli/tests}/format_conversions/ods.rs | 0 .../tests}/format_conversions/sqlite.rs | 0 .../nu-cli/tests}/format_conversions/ssv.rs | 0 .../nu-cli/tests}/format_conversions/toml.rs | 0 .../nu-cli/tests}/format_conversions/tsv.rs | 0 .../nu-cli/tests}/format_conversions/url.rs | 0 .../nu-cli/tests}/format_conversions/xlsx.rs | 0 .../nu-cli/tests}/format_conversions/yaml.rs | 0 crates/nu-cli/tests/main.rs | 4 + crates/nu-test-support/src/fs.rs | 40 +++++- crates/nu-test-support/src/playground.rs | 14 +- docker/Dockerfile.nu-base | 3 +- src/main.rs | 22 +-- tests/main.rs | 2 - 210 files changed, 239 insertions(+), 206 deletions(-) create mode 100644 .dockerignore create mode 100644 crates/nu-cli/Cargo.toml rename {src => crates/nu-cli/src}/cli.rs (97%) rename {src => crates/nu-cli/src}/commands.rs (100%) rename {src => crates/nu-cli/src}/commands/append.rs (100%) rename {src => crates/nu-cli/src}/commands/args.rs (100%) rename {src => crates/nu-cli/src}/commands/autoview.rs (100%) rename {src => crates/nu-cli/src}/commands/calc.rs (100%) rename {src => crates/nu-cli/src}/commands/cd.rs (100%) rename {src => crates/nu-cli/src}/commands/classified/dynamic.rs (100%) rename {src => crates/nu-cli/src}/commands/classified/external.rs (100%) rename {src => crates/nu-cli/src}/commands/classified/internal.rs (100%) rename {src => crates/nu-cli/src}/commands/classified/mod.rs (100%) rename {src => crates/nu-cli/src}/commands/classified/pipeline.rs (100%) rename {src => crates/nu-cli/src}/commands/clear.rs (100%) rename {src => crates/nu-cli/src}/commands/clip.rs (100%) rename {src => crates/nu-cli/src}/commands/command.rs (100%) rename {src => crates/nu-cli/src}/commands/compact.rs (100%) rename {src => crates/nu-cli/src}/commands/config.rs (100%) rename {src => crates/nu-cli/src}/commands/count.rs (100%) rename {src => crates/nu-cli/src}/commands/cp.rs (100%) rename {src => crates/nu-cli/src}/commands/date.rs (100%) rename {src => crates/nu-cli/src}/commands/debug.rs (100%) rename {src => crates/nu-cli/src}/commands/default.rs (100%) rename {src => crates/nu-cli/src}/commands/du.rs (100%) rename {src => crates/nu-cli/src}/commands/echo.rs (100%) rename {src => crates/nu-cli/src}/commands/edit.rs (100%) rename {src => crates/nu-cli/src}/commands/enter.rs (100%) rename {src => crates/nu-cli/src}/commands/env.rs (100%) rename {src => crates/nu-cli/src}/commands/evaluate_by.rs (100%) rename {src => crates/nu-cli/src}/commands/exit.rs (100%) rename {src => crates/nu-cli/src}/commands/first.rs (100%) rename {src => crates/nu-cli/src}/commands/format.rs (100%) rename {src => crates/nu-cli/src}/commands/from_bson.rs (100%) rename {src => crates/nu-cli/src}/commands/from_csv.rs (100%) rename {src => crates/nu-cli/src}/commands/from_delimited_data.rs (100%) rename {src => crates/nu-cli/src}/commands/from_ini.rs (100%) rename {src => crates/nu-cli/src}/commands/from_json.rs (100%) rename {src => crates/nu-cli/src}/commands/from_ods.rs (100%) rename {src => crates/nu-cli/src}/commands/from_sqlite.rs (100%) rename {src => crates/nu-cli/src}/commands/from_ssv.rs (100%) rename {src => crates/nu-cli/src}/commands/from_toml.rs (100%) rename {src => crates/nu-cli/src}/commands/from_tsv.rs (100%) rename {src => crates/nu-cli/src}/commands/from_url.rs (100%) rename {src => crates/nu-cli/src}/commands/from_xlsx.rs (100%) rename {src => crates/nu-cli/src}/commands/from_xml.rs (100%) rename {src => crates/nu-cli/src}/commands/from_yaml.rs (100%) rename {src => crates/nu-cli/src}/commands/get.rs (100%) rename {src => crates/nu-cli/src}/commands/group_by.rs (100%) rename {src => crates/nu-cli/src}/commands/help.rs (100%) rename {src => crates/nu-cli/src}/commands/histogram.rs (100%) rename {src => crates/nu-cli/src}/commands/history.rs (100%) rename {src => crates/nu-cli/src}/commands/insert.rs (100%) rename {src => crates/nu-cli/src}/commands/kill.rs (100%) rename {src => crates/nu-cli/src}/commands/last.rs (100%) rename {src => crates/nu-cli/src}/commands/lines.rs (100%) rename {src => crates/nu-cli/src}/commands/ls.rs (100%) rename {src => crates/nu-cli/src}/commands/macros.rs (100%) rename {src => crates/nu-cli/src}/commands/map_max_by.rs (100%) rename {src => crates/nu-cli/src}/commands/mkdir.rs (100%) rename {src => crates/nu-cli/src}/commands/mv.rs (100%) rename {src => crates/nu-cli/src}/commands/next.rs (100%) rename {src => crates/nu-cli/src}/commands/nth.rs (100%) rename {src => crates/nu-cli/src}/commands/open.rs (100%) rename {src => crates/nu-cli/src}/commands/parse.rs (100%) rename {src => crates/nu-cli/src}/commands/pick.rs (100%) rename {src => crates/nu-cli/src}/commands/pivot.rs (100%) rename {src => crates/nu-cli/src}/commands/plugin.rs (100%) rename {src => crates/nu-cli/src}/commands/prepend.rs (100%) rename {src => crates/nu-cli/src}/commands/prev.rs (100%) rename {src => crates/nu-cli/src}/commands/pwd.rs (100%) rename {src => crates/nu-cli/src}/commands/range.rs (100%) rename {src => crates/nu-cli/src}/commands/reduce_by.rs (100%) rename {src => crates/nu-cli/src}/commands/reject.rs (100%) rename {src => crates/nu-cli/src}/commands/rename.rs (100%) rename {src => crates/nu-cli/src}/commands/reverse.rs (100%) rename {src => crates/nu-cli/src}/commands/rm.rs (100%) rename {src => crates/nu-cli/src}/commands/save.rs (100%) rename {src => crates/nu-cli/src}/commands/shells.rs (100%) rename {src => crates/nu-cli/src}/commands/size.rs (100%) rename {src => crates/nu-cli/src}/commands/skip.rs (100%) rename {src => crates/nu-cli/src}/commands/skip_while.rs (100%) rename {src => crates/nu-cli/src}/commands/sort_by.rs (100%) rename {src => crates/nu-cli/src}/commands/split_by.rs (100%) rename {src => crates/nu-cli/src}/commands/split_column.rs (100%) rename {src => crates/nu-cli/src}/commands/split_row.rs (100%) rename {src => crates/nu-cli/src}/commands/t_sort_by.rs (100%) rename {src => crates/nu-cli/src}/commands/table.rs (100%) rename {src => crates/nu-cli/src}/commands/tags.rs (100%) rename {src => crates/nu-cli/src}/commands/to_bson.rs (100%) rename {src => crates/nu-cli/src}/commands/to_csv.rs (100%) rename {src => crates/nu-cli/src}/commands/to_delimited_data.rs (100%) rename {src => crates/nu-cli/src}/commands/to_json.rs (100%) rename {src => crates/nu-cli/src}/commands/to_sqlite.rs (100%) rename {src => crates/nu-cli/src}/commands/to_toml.rs (100%) rename {src => crates/nu-cli/src}/commands/to_tsv.rs (100%) rename {src => crates/nu-cli/src}/commands/to_url.rs (100%) rename {src => crates/nu-cli/src}/commands/to_yaml.rs (100%) rename {src => crates/nu-cli/src}/commands/touch.rs (100%) rename {src => crates/nu-cli/src}/commands/trim.rs (100%) rename {src => crates/nu-cli/src}/commands/uniq.rs (100%) rename {src => crates/nu-cli/src}/commands/version.rs (100%) rename {src => crates/nu-cli/src}/commands/what.rs (100%) rename {src => crates/nu-cli/src}/commands/where_.rs (100%) rename {src => crates/nu-cli/src}/commands/which_.rs (100%) rename {src => crates/nu-cli/src}/commands/wrap.rs (100%) rename {src => crates/nu-cli/src}/context.rs (100%) rename {src => crates/nu-cli/src}/data.rs (100%) rename {src => crates/nu-cli/src}/data/base.rs (100%) rename {src => crates/nu-cli/src}/data/base/shape.rs (100%) rename {src => crates/nu-cli/src}/data/command.rs (100%) rename {src => crates/nu-cli/src}/data/config.rs (100%) rename {src => crates/nu-cli/src}/data/config/conf.rs (100%) rename {src => crates/nu-cli/src}/data/config/nuconfig.rs (100%) rename {src => crates/nu-cli/src}/data/config/tests.rs (100%) rename {src => crates/nu-cli/src}/data/dict.rs (100%) rename {src => crates/nu-cli/src}/data/files.rs (100%) rename {src => crates/nu-cli/src}/data/operators.rs (100%) rename {src => crates/nu-cli/src}/data/primitive.rs (100%) rename {src => crates/nu-cli/src}/data/process.rs (100%) rename {src => crates/nu-cli/src}/data/types.rs (100%) rename {src => crates/nu-cli/src}/data/value.rs (100%) rename {src => crates/nu-cli/src}/deserializer.rs (100%) rename {src => crates/nu-cli/src}/env.rs (100%) rename {src => crates/nu-cli/src}/env/environment.rs (100%) rename {src => crates/nu-cli/src}/env/environment_syncer.rs (100%) rename {src => crates/nu-cli/src}/env/host.rs (100%) rename {src => crates/nu-cli/src}/evaluate/evaluate_args.rs (100%) rename {src => crates/nu-cli/src}/evaluate/evaluator.rs (100%) rename {src => crates/nu-cli/src}/evaluate/mod.rs (100%) rename {src => crates/nu-cli/src}/evaluate/operator.rs (100%) rename {src => crates/nu-cli/src}/evaluate/variables.rs (100%) rename {src => crates/nu-cli/src}/format.rs (100%) rename {src => crates/nu-cli/src}/format/entries.rs (100%) rename {src => crates/nu-cli/src}/format/generic.rs (100%) rename {src => crates/nu-cli/src}/format/list.rs (100%) rename {src => crates/nu-cli/src}/format/table.rs (100%) rename {src => crates/nu-cli/src}/futures.rs (100%) rename {src => crates/nu-cli/src}/git.rs (100%) rename {src => crates/nu-cli/src}/lib.rs (100%) rename {src => crates/nu-cli/src}/prelude.rs (100%) rename {src => crates/nu-cli/src}/shell.rs (100%) rename {src => crates/nu-cli/src}/shell/completer.rs (100%) rename {src => crates/nu-cli/src}/shell/filesystem_shell.rs (100%) rename {src => crates/nu-cli/src}/shell/help_shell.rs (100%) rename {src => crates/nu-cli/src}/shell/helper.rs (100%) rename {src => crates/nu-cli/src}/shell/shell.rs (100%) rename {src => crates/nu-cli/src}/shell/shell_manager.rs (100%) rename {src => crates/nu-cli/src}/shell/value_shell.rs (100%) rename {src => crates/nu-cli/src}/stream.rs (100%) rename {src => crates/nu-cli/src}/utils.rs (98%) rename {src => crates/nu-cli/src}/utils/data_processing.rs (100%) rename {tests => crates/nu-cli/tests}/commands/append.rs (100%) rename {tests => crates/nu-cli/tests}/commands/calc.rs (100%) rename {tests => crates/nu-cli/tests}/commands/cd.rs (100%) rename {tests => crates/nu-cli/tests}/commands/compact.rs (100%) rename {tests => crates/nu-cli/tests}/commands/cp.rs (100%) rename {tests => crates/nu-cli/tests}/commands/default.rs (100%) rename {tests => crates/nu-cli/tests}/commands/edit.rs (100%) rename {tests => crates/nu-cli/tests}/commands/enter.rs (100%) rename {tests => crates/nu-cli/tests}/commands/first.rs (100%) rename {tests => crates/nu-cli/tests}/commands/format.rs (100%) rename {tests => crates/nu-cli/tests}/commands/get.rs (100%) rename {tests => crates/nu-cli/tests}/commands/group_by.rs (100%) rename {tests => crates/nu-cli/tests}/commands/histogram.rs (100%) rename {tests => crates/nu-cli/tests}/commands/insert.rs (100%) rename {tests => crates/nu-cli/tests}/commands/last.rs (100%) rename {tests => crates/nu-cli/tests}/commands/lines.rs (100%) rename {tests => crates/nu-cli/tests}/commands/ls.rs (100%) rename {tests => crates/nu-cli/tests}/commands/mkdir.rs (100%) rename {tests => crates/nu-cli/tests}/commands/mod.rs (100%) rename {tests => crates/nu-cli/tests}/commands/mv.rs (100%) rename {tests => crates/nu-cli/tests}/commands/nth.rs (100%) rename {tests => crates/nu-cli/tests}/commands/open.rs (100%) rename {tests => crates/nu-cli/tests}/commands/parse.rs (100%) rename {tests => crates/nu-cli/tests}/commands/pick.rs (100%) rename {tests => crates/nu-cli/tests}/commands/prepend.rs (100%) rename {tests => crates/nu-cli/tests}/commands/range.rs (100%) rename {tests => crates/nu-cli/tests}/commands/rename.rs (100%) rename {tests => crates/nu-cli/tests}/commands/reverse.rs (100%) rename {tests => crates/nu-cli/tests}/commands/rm.rs (100%) rename {tests => crates/nu-cli/tests}/commands/save.rs (100%) rename {tests => crates/nu-cli/tests}/commands/sort_by.rs (100%) rename {tests => crates/nu-cli/tests}/commands/split_by.rs (100%) rename {tests => crates/nu-cli/tests}/commands/split_column.rs (100%) rename {tests => crates/nu-cli/tests}/commands/touch.rs (100%) rename {tests => crates/nu-cli/tests}/commands/uniq.rs (100%) rename {tests => crates/nu-cli/tests}/commands/where_.rs (100%) rename {tests => crates/nu-cli/tests}/commands/wrap.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/bson.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/csv.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/json.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/mod.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/ods.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/sqlite.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/ssv.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/toml.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/tsv.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/url.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/xlsx.rs (100%) rename {tests => crates/nu-cli/tests}/format_conversions/yaml.rs (100%) create mode 100644 crates/nu-cli/tests/main.rs diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..eb5a316cbd --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +target diff --git a/.gitignore b/.gitignore index 7c87057329..b6095258f7 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ history.txt tests/fixtures/nuplayground crates/*/target + # Debian/Ubuntu debian/.debhelper/ debian/debhelper-build-stamp diff --git a/Cargo.lock b/Cargo.lock index 39c2525771..7678db655c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2190,6 +2190,61 @@ dependencies = [ [[package]] name = "nu" version = "0.10.1" +dependencies = [ + "clap", + "clipboard", + "crossterm 0.16.0", + "ctrlc", + "dunce", + "futures 0.3.3", + "log", + "nu-build", + "nu-cli", + "nu-errors", + "nu-macros", + "nu-parser", + "nu-plugin", + "nu-protocol", + "nu-source", + "nu-test-support", + "nu-value-ext", + "nu_plugin_average", + "nu_plugin_binaryview", + "nu_plugin_fetch", + "nu_plugin_inc", + "nu_plugin_match", + "nu_plugin_post", + "nu_plugin_ps", + "nu_plugin_shuffle", + "nu_plugin_str", + "nu_plugin_sum", + "nu_plugin_sys", + "nu_plugin_textview", + "nu_plugin_tree", + "onig_sys", + "pretty_assertions", + "pretty_env_logger 0.4.0", + "semver", + "serde 1.0.104", + "starship", + "syntect", + "toml 0.5.6", + "url", +] + +[[package]] +name = "nu-build" +version = "0.10.0" +dependencies = [ + "lazy_static 1.4.0", + "serde 1.0.104", + "serde_json", + "toml 0.5.6", +] + +[[package]] +name = "nu-cli" +version = "0.10.0" dependencies = [ "ansi_term 0.12.1", "app_dirs", @@ -2203,8 +2258,6 @@ dependencies = [ "cfg-if", "chrono", "clap", - "clipboard", - "crossterm 0.16.0", "csv", "ctrlc", "derive-new", @@ -2237,22 +2290,8 @@ dependencies = [ "nu-source", "nu-test-support", "nu-value-ext", - "nu_plugin_average", - "nu_plugin_binaryview", - "nu_plugin_fetch", - "nu_plugin_inc", - "nu_plugin_match", - "nu_plugin_post", - "nu_plugin_ps", - "nu_plugin_shuffle", - "nu_plugin_str", - "nu_plugin_sum", - "nu_plugin_sys", - "nu_plugin_textview", - "nu_plugin_tree", "num-bigint", "num-traits 0.2.11", - "onig_sys", "parking_lot", "pin-utils", "pretty-hex", @@ -2265,7 +2304,6 @@ dependencies = [ "roxmltree", "rusqlite", "rustyline", - "semver", "serde 1.0.104", "serde-hjson 0.9.1", "serde_bytes", @@ -2274,9 +2312,7 @@ dependencies = [ "serde_urlencoded", "serde_yaml", "shellexpand", - "starship", "strip-ansi-escapes", - "syntect", "tempfile", "term", "termcolor", @@ -2286,21 +2322,10 @@ dependencies = [ "typetag", "umask", "unicode-xid", - "url", "users", "which", ] -[[package]] -name = "nu-build" -version = "0.10.0" -dependencies = [ - "lazy_static 1.4.0", - "serde 1.0.104", - "serde_json", - "toml 0.5.6", -] - [[package]] name = "nu-errors" version = "0.10.0" diff --git a/Cargo.toml b/Cargo.toml index 1567f26e2b..04e4ec32d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,34 +13,12 @@ documentation = "https://www.nushell.sh/book/" exclude = ["images"] [workspace] - -members = [ - "crates/nu-macros", - "crates/nu-errors", - "crates/nu-source", - "crates/nu_plugin_average", - "crates/nu_plugin_binaryview", - "crates/nu_plugin_fetch", - "crates/nu_plugin_inc", - "crates/nu_plugin_match", - "crates/nu_plugin_post", - "crates/nu_plugin_ps", - "crates/nu_plugin_shuffle", - "crates/nu_plugin_str", - "crates/nu_plugin_sum", - "crates/nu_plugin_sys", - "crates/nu_plugin_textview", - "crates/nu_plugin_tree", - "crates/nu-protocol", - "crates/nu-plugin", - "crates/nu-parser", - "crates/nu-value-ext", - "crates/nu-build" -] +members = ["crates/*/"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +nu-cli = { version = "0.10.0", path = "./crates/nu-cli" } nu-source = { version = "0.10.0", path = "./crates/nu-source" } nu-plugin = { version = "0.10.0", path = "./crates/nu-plugin" } nu-protocol = { version = "0.10.0", path = "./crates/nu-protocol" } @@ -62,83 +40,29 @@ nu_plugin_textview = { version = "0.10.0", path = "./crates/nu_plugin_textview", nu_plugin_tree = { version = "0.10.0", path = "./crates/nu_plugin_tree", optional=true } nu-macros = { version = "0.10.0", path = "./crates/nu-macros" } -query_interface = "0.3.5" -typetag = "0.1.4" -rustyline = "6.0.0" -chrono = { version = "0.4.10", features = ["serde"] } -derive-new = "0.5.8" -prettytable-rs = "0.8.0" -itertools = "0.8.2" -ansi_term = "0.12.1" -nom = "5.0.1" +clipboard = { version = "0.5", optional = true } +crossterm = { version = "0.16.0", optional = true } +onig_sys = { version = "=69.1.0", optional = true } +semver = { version = "0.9.0", optional = true } +starship = { version = "0.35.1", optional = true } +syntect = { version = "3.2.0", optional = true } +url = { version = "2.1.1", optional = true } + +clap = "2.33.0" +ctrlc = "3.1.3" dunce = "1.0.0" -indexmap = { version = "1.3.2", features = ["serde-1"] } -byte-unit = "3.0.3" -base64 = "0.11" futures = { version = "0.3", features = ["compat", "io-compat"] } -async-stream = "0.2" -futures_codec = "0.4" -num-traits = "0.2.11" -term = "0.5.2" -bytes = "0.4.12" log = "0.4.8" pretty_env_logger = "0.4.0" -serde = { version = "1.0.104", features = ["derive"] } -bson = { version = "0.14.0", features = ["decimal128"] } -serde_json = "1.0.47" -serde-hjson = "0.9.1" -serde_yaml = "0.8" -serde_bytes = "0.11.3" -getset = "0.0.9" -language-reporting = "0.4.0" -app_dirs = "1.2.1" -csv = "1.1" + +[dev-dependencies] +pretty_assertions = "0.6.1" +nu-test-support = { version = "0.10.0", path = "./crates/nu-test-support" } + +[build-dependencies] toml = "0.5.6" -clap = "2.33.0" -git2 = { version = "0.11.0", default_features = false } -dirs = "2.0.2" -glob = "0.3.0" -ctrlc = "3.1.3" -roxmltree = "0.9.1" -nom_locate = "1.0.0" -nom-tracable = "0.4.1" -unicode-xid = "0.2.0" -serde_ini = "0.2.0" -pretty-hex = "0.1.1" -hex = "0.4" -tempfile = "3.1.0" -which = "3.1.0" -ichwh = "0.3" -textwrap = {version = "0.11.0", features = ["term_size"]} -shellexpand = "1.1.1" -pin-utils = "0.1.0-alpha.4" -num-bigint = { version = "0.2.6", features = ["serde"] } -bigdecimal = { version = "0.1.0", features = ["serde"] } -serde_urlencoded = "0.6.1" -trash = "1.0.0" -regex = "1" -cfg-if = "0.1" -strip-ansi-escapes = "0.1.0" -calamine = "0.16" -umask = "0.1" -futures-util = "0.3.4" -termcolor = "1.1.0" -natural = "0.3.0" -parking_lot = "0.10.0" -meval = "0.2" - -clipboard = {version = "0.5", optional = true } -ptree = {version = "0.2" } -starship = { version = "0.35.1", optional = true} -syntect = {version = "3.2.0", optional = true } -onig_sys = {version = "=69.1.0", optional = true } -crossterm = {version = "0.16.0", optional = true} -url = {version = "2.1.1", optional = true} -semver = {version = "0.9.0", optional = true} -filesize = "0.1.0" - -[target.'cfg(unix)'.dependencies] -users = "0.9" +serde = { version = "1.0.104", features = ["derive"] } +nu-build = { version = "0.10.0", path = "./crates/nu-build" } [features] # Test executables @@ -166,24 +90,6 @@ sum = ["nu_plugin_sum"] trace = ["nu-parser/trace"] tree = ["nu_plugin_tree"] -[dependencies.rusqlite] -version = "0.20.0" -features = ["bundled", "blob"] - -[dev-dependencies] -pretty_assertions = "0.6.1" -nu-test-support = { version = "0.10.0", path = "./crates/nu-test-support" } - -[build-dependencies] -toml = "0.5.6" -serde = { version = "1.0.104", features = ["derive"] } -nu-build = { version = "0.10.0", path = "./crates/nu-build" } - -[lib] -name = "nu" -doctest = false -path = "src/lib.rs" - [[bin]] name = "fail" path = "crates/nu-test-support/src/bins/fail.rs" diff --git a/crates/nu-cli/Cargo.toml b/crates/nu-cli/Cargo.toml new file mode 100644 index 0000000000..3c6ff93507 --- /dev/null +++ b/crates/nu-cli/Cargo.toml @@ -0,0 +1,99 @@ +[package] +name = "nu-cli" +version = "0.10.0" +authors = ["Yehuda Katz ", "Jonathan Turner ", "Andrés N. Robalino "] +description = "CLI for nushell" +edition = "2018" + +[lib] +doctest = false + +[dependencies] +nu-source = { version = "0.10.0", path = "../nu-source" } +nu-plugin = { version = "0.10.0", path = "../nu-plugin" } +nu-protocol = { version = "0.10.0", path = "../nu-protocol" } +nu-errors = { version = "0.10.0", path = "../nu-errors" } +nu-parser = { version = "0.10.0", path = "../nu-parser" } +nu-value-ext = { version = "0.10.0", path = "../nu-value-ext" } +nu-macros = { version = "0.10.0", path = "../nu-macros" } +nu-test-support = { version = "0.10.0", path = "../nu-test-support" } + +ansi_term = "0.12.1" +app_dirs = "1.2.1" +async-stream = "0.2" +base64 = "0.11" +bigdecimal = { version = "0.1.0", features = ["serde"] } +bson = { version = "0.14.0", features = ["decimal128"] } +byte-unit = "3.0.3" +bytes = "0.4.12" +calamine = "0.16" +cfg-if = "0.1" +chrono = { version = "0.4.10", features = ["serde"] } +clap = "2.33.0" +csv = "1.1" +ctrlc = "3.1.3" +derive-new = "0.5.8" +dirs = "2.0.2" +dunce = "1.0.0" +filesize = "0.1.0" +futures = { version = "0.3", features = ["compat", "io-compat"] } +futures-util = "0.3.4" +futures_codec = "0.4" +getset = "0.0.9" +git2 = { version = "0.11.0", default_features = false } +glob = "0.3.0" +hex = "0.4" +ichwh = "0.3" +indexmap = { version = "1.3.2", features = ["serde-1"] } +itertools = "0.8.2" +language-reporting = "0.4.0" +log = "0.4.8" +meval = "0.2" +natural = "0.3.0" +nom = "5.0.1" +nom-tracable = "0.4.1" +nom_locate = "1.0.0" +num-bigint = { version = "0.2.6", features = ["serde"] } +num-traits = "0.2.11" +parking_lot = "0.10.0" +pin-utils = "0.1.0-alpha.4" +pretty-hex = "0.1.1" +pretty_env_logger = "0.4.0" +prettytable-rs = "0.8.0" +ptree = {version = "0.2" } +query_interface = "0.3.5" +regex = "1" +roxmltree = "0.9.1" +rustyline = "6.0.0" +serde = { version = "1.0.104", features = ["derive"] } +serde-hjson = "0.9.1" +serde_bytes = "0.11.3" +serde_ini = "0.2.0" +serde_json = "1.0.47" +serde_urlencoded = "0.6.1" +serde_yaml = "0.8" +shellexpand = "1.1.1" +strip-ansi-escapes = "0.1.0" +tempfile = "3.1.0" +term = "0.5.2" +termcolor = "1.1.0" +textwrap = {version = "0.11.0", features = ["term_size"]} +toml = "0.5.6" +trash = "1.0.0" +typetag = "0.1.4" +umask = "0.1" +unicode-xid = "0.2.0" +which = "3.1.0" + +[target.'cfg(unix)'.dependencies] +users = "0.9" + +[dependencies.rusqlite] +version = "0.20.0" +features = ["bundled", "blob"] + +[dev-dependencies] +pretty_assertions = "0.6.1" + +[build-dependencies] +nu-build = { version = "0.10.0", path = "../nu-build" } diff --git a/src/cli.rs b/crates/nu-cli/src/cli.rs similarity index 97% rename from src/cli.rs rename to crates/nu-cli/src/cli.rs index d28f94c3fb..510d238e07 100644 --- a/src/cli.rs +++ b/crates/nu-cli/src/cli.rs @@ -93,44 +93,27 @@ fn load_plugin(path: &std::path::Path, context: &mut Context) -> Result<(), Shel } fn search_paths() -> Vec { + use std::env; + let mut search_paths = Vec::new(); - #[cfg(debug_assertions)] - { - // Use our debug plugins in debug mode - let mut path = std::path::PathBuf::from("."); - path.push("target"); - path.push("debug"); - - if path.exists() { - search_paths.push(path); + // Automatically add path `nu` is in as a search path + if let Ok(exe_path) = env::current_exe() { + if let Some(exe_dir) = exe_path.parent() { + search_paths.push(exe_dir.to_path_buf()); } } #[cfg(not(debug_assertions))] { - use std::env; - match env::var_os("PATH") { Some(paths) => { - search_paths = env::split_paths(&paths).collect::>(); + search_paths.extend(env::split_paths(&paths).collect::>()); } None => println!("PATH is not defined in the environment."), } - - // Use our release plugins in release mode - let mut path = std::path::PathBuf::from("."); - path.push("target"); - path.push("release"); - - if path.exists() { - search_paths.push(path); - } } - // permit Nu finding and picking up development plugins - // if there are any first. - search_paths.reverse(); search_paths } diff --git a/src/commands.rs b/crates/nu-cli/src/commands.rs similarity index 100% rename from src/commands.rs rename to crates/nu-cli/src/commands.rs diff --git a/src/commands/append.rs b/crates/nu-cli/src/commands/append.rs similarity index 100% rename from src/commands/append.rs rename to crates/nu-cli/src/commands/append.rs diff --git a/src/commands/args.rs b/crates/nu-cli/src/commands/args.rs similarity index 100% rename from src/commands/args.rs rename to crates/nu-cli/src/commands/args.rs diff --git a/src/commands/autoview.rs b/crates/nu-cli/src/commands/autoview.rs similarity index 100% rename from src/commands/autoview.rs rename to crates/nu-cli/src/commands/autoview.rs diff --git a/src/commands/calc.rs b/crates/nu-cli/src/commands/calc.rs similarity index 100% rename from src/commands/calc.rs rename to crates/nu-cli/src/commands/calc.rs diff --git a/src/commands/cd.rs b/crates/nu-cli/src/commands/cd.rs similarity index 100% rename from src/commands/cd.rs rename to crates/nu-cli/src/commands/cd.rs diff --git a/src/commands/classified/dynamic.rs b/crates/nu-cli/src/commands/classified/dynamic.rs similarity index 100% rename from src/commands/classified/dynamic.rs rename to crates/nu-cli/src/commands/classified/dynamic.rs diff --git a/src/commands/classified/external.rs b/crates/nu-cli/src/commands/classified/external.rs similarity index 100% rename from src/commands/classified/external.rs rename to crates/nu-cli/src/commands/classified/external.rs diff --git a/src/commands/classified/internal.rs b/crates/nu-cli/src/commands/classified/internal.rs similarity index 100% rename from src/commands/classified/internal.rs rename to crates/nu-cli/src/commands/classified/internal.rs diff --git a/src/commands/classified/mod.rs b/crates/nu-cli/src/commands/classified/mod.rs similarity index 100% rename from src/commands/classified/mod.rs rename to crates/nu-cli/src/commands/classified/mod.rs diff --git a/src/commands/classified/pipeline.rs b/crates/nu-cli/src/commands/classified/pipeline.rs similarity index 100% rename from src/commands/classified/pipeline.rs rename to crates/nu-cli/src/commands/classified/pipeline.rs diff --git a/src/commands/clear.rs b/crates/nu-cli/src/commands/clear.rs similarity index 100% rename from src/commands/clear.rs rename to crates/nu-cli/src/commands/clear.rs diff --git a/src/commands/clip.rs b/crates/nu-cli/src/commands/clip.rs similarity index 100% rename from src/commands/clip.rs rename to crates/nu-cli/src/commands/clip.rs diff --git a/src/commands/command.rs b/crates/nu-cli/src/commands/command.rs similarity index 100% rename from src/commands/command.rs rename to crates/nu-cli/src/commands/command.rs diff --git a/src/commands/compact.rs b/crates/nu-cli/src/commands/compact.rs similarity index 100% rename from src/commands/compact.rs rename to crates/nu-cli/src/commands/compact.rs diff --git a/src/commands/config.rs b/crates/nu-cli/src/commands/config.rs similarity index 100% rename from src/commands/config.rs rename to crates/nu-cli/src/commands/config.rs diff --git a/src/commands/count.rs b/crates/nu-cli/src/commands/count.rs similarity index 100% rename from src/commands/count.rs rename to crates/nu-cli/src/commands/count.rs diff --git a/src/commands/cp.rs b/crates/nu-cli/src/commands/cp.rs similarity index 100% rename from src/commands/cp.rs rename to crates/nu-cli/src/commands/cp.rs diff --git a/src/commands/date.rs b/crates/nu-cli/src/commands/date.rs similarity index 100% rename from src/commands/date.rs rename to crates/nu-cli/src/commands/date.rs diff --git a/src/commands/debug.rs b/crates/nu-cli/src/commands/debug.rs similarity index 100% rename from src/commands/debug.rs rename to crates/nu-cli/src/commands/debug.rs diff --git a/src/commands/default.rs b/crates/nu-cli/src/commands/default.rs similarity index 100% rename from src/commands/default.rs rename to crates/nu-cli/src/commands/default.rs diff --git a/src/commands/du.rs b/crates/nu-cli/src/commands/du.rs similarity index 100% rename from src/commands/du.rs rename to crates/nu-cli/src/commands/du.rs diff --git a/src/commands/echo.rs b/crates/nu-cli/src/commands/echo.rs similarity index 100% rename from src/commands/echo.rs rename to crates/nu-cli/src/commands/echo.rs diff --git a/src/commands/edit.rs b/crates/nu-cli/src/commands/edit.rs similarity index 100% rename from src/commands/edit.rs rename to crates/nu-cli/src/commands/edit.rs diff --git a/src/commands/enter.rs b/crates/nu-cli/src/commands/enter.rs similarity index 100% rename from src/commands/enter.rs rename to crates/nu-cli/src/commands/enter.rs diff --git a/src/commands/env.rs b/crates/nu-cli/src/commands/env.rs similarity index 100% rename from src/commands/env.rs rename to crates/nu-cli/src/commands/env.rs diff --git a/src/commands/evaluate_by.rs b/crates/nu-cli/src/commands/evaluate_by.rs similarity index 100% rename from src/commands/evaluate_by.rs rename to crates/nu-cli/src/commands/evaluate_by.rs diff --git a/src/commands/exit.rs b/crates/nu-cli/src/commands/exit.rs similarity index 100% rename from src/commands/exit.rs rename to crates/nu-cli/src/commands/exit.rs diff --git a/src/commands/first.rs b/crates/nu-cli/src/commands/first.rs similarity index 100% rename from src/commands/first.rs rename to crates/nu-cli/src/commands/first.rs diff --git a/src/commands/format.rs b/crates/nu-cli/src/commands/format.rs similarity index 100% rename from src/commands/format.rs rename to crates/nu-cli/src/commands/format.rs diff --git a/src/commands/from_bson.rs b/crates/nu-cli/src/commands/from_bson.rs similarity index 100% rename from src/commands/from_bson.rs rename to crates/nu-cli/src/commands/from_bson.rs diff --git a/src/commands/from_csv.rs b/crates/nu-cli/src/commands/from_csv.rs similarity index 100% rename from src/commands/from_csv.rs rename to crates/nu-cli/src/commands/from_csv.rs diff --git a/src/commands/from_delimited_data.rs b/crates/nu-cli/src/commands/from_delimited_data.rs similarity index 100% rename from src/commands/from_delimited_data.rs rename to crates/nu-cli/src/commands/from_delimited_data.rs diff --git a/src/commands/from_ini.rs b/crates/nu-cli/src/commands/from_ini.rs similarity index 100% rename from src/commands/from_ini.rs rename to crates/nu-cli/src/commands/from_ini.rs diff --git a/src/commands/from_json.rs b/crates/nu-cli/src/commands/from_json.rs similarity index 100% rename from src/commands/from_json.rs rename to crates/nu-cli/src/commands/from_json.rs diff --git a/src/commands/from_ods.rs b/crates/nu-cli/src/commands/from_ods.rs similarity index 100% rename from src/commands/from_ods.rs rename to crates/nu-cli/src/commands/from_ods.rs diff --git a/src/commands/from_sqlite.rs b/crates/nu-cli/src/commands/from_sqlite.rs similarity index 100% rename from src/commands/from_sqlite.rs rename to crates/nu-cli/src/commands/from_sqlite.rs diff --git a/src/commands/from_ssv.rs b/crates/nu-cli/src/commands/from_ssv.rs similarity index 100% rename from src/commands/from_ssv.rs rename to crates/nu-cli/src/commands/from_ssv.rs diff --git a/src/commands/from_toml.rs b/crates/nu-cli/src/commands/from_toml.rs similarity index 100% rename from src/commands/from_toml.rs rename to crates/nu-cli/src/commands/from_toml.rs diff --git a/src/commands/from_tsv.rs b/crates/nu-cli/src/commands/from_tsv.rs similarity index 100% rename from src/commands/from_tsv.rs rename to crates/nu-cli/src/commands/from_tsv.rs diff --git a/src/commands/from_url.rs b/crates/nu-cli/src/commands/from_url.rs similarity index 100% rename from src/commands/from_url.rs rename to crates/nu-cli/src/commands/from_url.rs diff --git a/src/commands/from_xlsx.rs b/crates/nu-cli/src/commands/from_xlsx.rs similarity index 100% rename from src/commands/from_xlsx.rs rename to crates/nu-cli/src/commands/from_xlsx.rs diff --git a/src/commands/from_xml.rs b/crates/nu-cli/src/commands/from_xml.rs similarity index 100% rename from src/commands/from_xml.rs rename to crates/nu-cli/src/commands/from_xml.rs diff --git a/src/commands/from_yaml.rs b/crates/nu-cli/src/commands/from_yaml.rs similarity index 100% rename from src/commands/from_yaml.rs rename to crates/nu-cli/src/commands/from_yaml.rs diff --git a/src/commands/get.rs b/crates/nu-cli/src/commands/get.rs similarity index 100% rename from src/commands/get.rs rename to crates/nu-cli/src/commands/get.rs diff --git a/src/commands/group_by.rs b/crates/nu-cli/src/commands/group_by.rs similarity index 100% rename from src/commands/group_by.rs rename to crates/nu-cli/src/commands/group_by.rs diff --git a/src/commands/help.rs b/crates/nu-cli/src/commands/help.rs similarity index 100% rename from src/commands/help.rs rename to crates/nu-cli/src/commands/help.rs diff --git a/src/commands/histogram.rs b/crates/nu-cli/src/commands/histogram.rs similarity index 100% rename from src/commands/histogram.rs rename to crates/nu-cli/src/commands/histogram.rs diff --git a/src/commands/history.rs b/crates/nu-cli/src/commands/history.rs similarity index 100% rename from src/commands/history.rs rename to crates/nu-cli/src/commands/history.rs diff --git a/src/commands/insert.rs b/crates/nu-cli/src/commands/insert.rs similarity index 100% rename from src/commands/insert.rs rename to crates/nu-cli/src/commands/insert.rs diff --git a/src/commands/kill.rs b/crates/nu-cli/src/commands/kill.rs similarity index 100% rename from src/commands/kill.rs rename to crates/nu-cli/src/commands/kill.rs diff --git a/src/commands/last.rs b/crates/nu-cli/src/commands/last.rs similarity index 100% rename from src/commands/last.rs rename to crates/nu-cli/src/commands/last.rs diff --git a/src/commands/lines.rs b/crates/nu-cli/src/commands/lines.rs similarity index 100% rename from src/commands/lines.rs rename to crates/nu-cli/src/commands/lines.rs diff --git a/src/commands/ls.rs b/crates/nu-cli/src/commands/ls.rs similarity index 100% rename from src/commands/ls.rs rename to crates/nu-cli/src/commands/ls.rs diff --git a/src/commands/macros.rs b/crates/nu-cli/src/commands/macros.rs similarity index 100% rename from src/commands/macros.rs rename to crates/nu-cli/src/commands/macros.rs diff --git a/src/commands/map_max_by.rs b/crates/nu-cli/src/commands/map_max_by.rs similarity index 100% rename from src/commands/map_max_by.rs rename to crates/nu-cli/src/commands/map_max_by.rs diff --git a/src/commands/mkdir.rs b/crates/nu-cli/src/commands/mkdir.rs similarity index 100% rename from src/commands/mkdir.rs rename to crates/nu-cli/src/commands/mkdir.rs diff --git a/src/commands/mv.rs b/crates/nu-cli/src/commands/mv.rs similarity index 100% rename from src/commands/mv.rs rename to crates/nu-cli/src/commands/mv.rs diff --git a/src/commands/next.rs b/crates/nu-cli/src/commands/next.rs similarity index 100% rename from src/commands/next.rs rename to crates/nu-cli/src/commands/next.rs diff --git a/src/commands/nth.rs b/crates/nu-cli/src/commands/nth.rs similarity index 100% rename from src/commands/nth.rs rename to crates/nu-cli/src/commands/nth.rs diff --git a/src/commands/open.rs b/crates/nu-cli/src/commands/open.rs similarity index 100% rename from src/commands/open.rs rename to crates/nu-cli/src/commands/open.rs diff --git a/src/commands/parse.rs b/crates/nu-cli/src/commands/parse.rs similarity index 100% rename from src/commands/parse.rs rename to crates/nu-cli/src/commands/parse.rs diff --git a/src/commands/pick.rs b/crates/nu-cli/src/commands/pick.rs similarity index 100% rename from src/commands/pick.rs rename to crates/nu-cli/src/commands/pick.rs diff --git a/src/commands/pivot.rs b/crates/nu-cli/src/commands/pivot.rs similarity index 100% rename from src/commands/pivot.rs rename to crates/nu-cli/src/commands/pivot.rs diff --git a/src/commands/plugin.rs b/crates/nu-cli/src/commands/plugin.rs similarity index 100% rename from src/commands/plugin.rs rename to crates/nu-cli/src/commands/plugin.rs diff --git a/src/commands/prepend.rs b/crates/nu-cli/src/commands/prepend.rs similarity index 100% rename from src/commands/prepend.rs rename to crates/nu-cli/src/commands/prepend.rs diff --git a/src/commands/prev.rs b/crates/nu-cli/src/commands/prev.rs similarity index 100% rename from src/commands/prev.rs rename to crates/nu-cli/src/commands/prev.rs diff --git a/src/commands/pwd.rs b/crates/nu-cli/src/commands/pwd.rs similarity index 100% rename from src/commands/pwd.rs rename to crates/nu-cli/src/commands/pwd.rs diff --git a/src/commands/range.rs b/crates/nu-cli/src/commands/range.rs similarity index 100% rename from src/commands/range.rs rename to crates/nu-cli/src/commands/range.rs diff --git a/src/commands/reduce_by.rs b/crates/nu-cli/src/commands/reduce_by.rs similarity index 100% rename from src/commands/reduce_by.rs rename to crates/nu-cli/src/commands/reduce_by.rs diff --git a/src/commands/reject.rs b/crates/nu-cli/src/commands/reject.rs similarity index 100% rename from src/commands/reject.rs rename to crates/nu-cli/src/commands/reject.rs diff --git a/src/commands/rename.rs b/crates/nu-cli/src/commands/rename.rs similarity index 100% rename from src/commands/rename.rs rename to crates/nu-cli/src/commands/rename.rs diff --git a/src/commands/reverse.rs b/crates/nu-cli/src/commands/reverse.rs similarity index 100% rename from src/commands/reverse.rs rename to crates/nu-cli/src/commands/reverse.rs diff --git a/src/commands/rm.rs b/crates/nu-cli/src/commands/rm.rs similarity index 100% rename from src/commands/rm.rs rename to crates/nu-cli/src/commands/rm.rs diff --git a/src/commands/save.rs b/crates/nu-cli/src/commands/save.rs similarity index 100% rename from src/commands/save.rs rename to crates/nu-cli/src/commands/save.rs diff --git a/src/commands/shells.rs b/crates/nu-cli/src/commands/shells.rs similarity index 100% rename from src/commands/shells.rs rename to crates/nu-cli/src/commands/shells.rs diff --git a/src/commands/size.rs b/crates/nu-cli/src/commands/size.rs similarity index 100% rename from src/commands/size.rs rename to crates/nu-cli/src/commands/size.rs diff --git a/src/commands/skip.rs b/crates/nu-cli/src/commands/skip.rs similarity index 100% rename from src/commands/skip.rs rename to crates/nu-cli/src/commands/skip.rs diff --git a/src/commands/skip_while.rs b/crates/nu-cli/src/commands/skip_while.rs similarity index 100% rename from src/commands/skip_while.rs rename to crates/nu-cli/src/commands/skip_while.rs diff --git a/src/commands/sort_by.rs b/crates/nu-cli/src/commands/sort_by.rs similarity index 100% rename from src/commands/sort_by.rs rename to crates/nu-cli/src/commands/sort_by.rs diff --git a/src/commands/split_by.rs b/crates/nu-cli/src/commands/split_by.rs similarity index 100% rename from src/commands/split_by.rs rename to crates/nu-cli/src/commands/split_by.rs diff --git a/src/commands/split_column.rs b/crates/nu-cli/src/commands/split_column.rs similarity index 100% rename from src/commands/split_column.rs rename to crates/nu-cli/src/commands/split_column.rs diff --git a/src/commands/split_row.rs b/crates/nu-cli/src/commands/split_row.rs similarity index 100% rename from src/commands/split_row.rs rename to crates/nu-cli/src/commands/split_row.rs diff --git a/src/commands/t_sort_by.rs b/crates/nu-cli/src/commands/t_sort_by.rs similarity index 100% rename from src/commands/t_sort_by.rs rename to crates/nu-cli/src/commands/t_sort_by.rs diff --git a/src/commands/table.rs b/crates/nu-cli/src/commands/table.rs similarity index 100% rename from src/commands/table.rs rename to crates/nu-cli/src/commands/table.rs diff --git a/src/commands/tags.rs b/crates/nu-cli/src/commands/tags.rs similarity index 100% rename from src/commands/tags.rs rename to crates/nu-cli/src/commands/tags.rs diff --git a/src/commands/to_bson.rs b/crates/nu-cli/src/commands/to_bson.rs similarity index 100% rename from src/commands/to_bson.rs rename to crates/nu-cli/src/commands/to_bson.rs diff --git a/src/commands/to_csv.rs b/crates/nu-cli/src/commands/to_csv.rs similarity index 100% rename from src/commands/to_csv.rs rename to crates/nu-cli/src/commands/to_csv.rs diff --git a/src/commands/to_delimited_data.rs b/crates/nu-cli/src/commands/to_delimited_data.rs similarity index 100% rename from src/commands/to_delimited_data.rs rename to crates/nu-cli/src/commands/to_delimited_data.rs diff --git a/src/commands/to_json.rs b/crates/nu-cli/src/commands/to_json.rs similarity index 100% rename from src/commands/to_json.rs rename to crates/nu-cli/src/commands/to_json.rs diff --git a/src/commands/to_sqlite.rs b/crates/nu-cli/src/commands/to_sqlite.rs similarity index 100% rename from src/commands/to_sqlite.rs rename to crates/nu-cli/src/commands/to_sqlite.rs diff --git a/src/commands/to_toml.rs b/crates/nu-cli/src/commands/to_toml.rs similarity index 100% rename from src/commands/to_toml.rs rename to crates/nu-cli/src/commands/to_toml.rs diff --git a/src/commands/to_tsv.rs b/crates/nu-cli/src/commands/to_tsv.rs similarity index 100% rename from src/commands/to_tsv.rs rename to crates/nu-cli/src/commands/to_tsv.rs diff --git a/src/commands/to_url.rs b/crates/nu-cli/src/commands/to_url.rs similarity index 100% rename from src/commands/to_url.rs rename to crates/nu-cli/src/commands/to_url.rs diff --git a/src/commands/to_yaml.rs b/crates/nu-cli/src/commands/to_yaml.rs similarity index 100% rename from src/commands/to_yaml.rs rename to crates/nu-cli/src/commands/to_yaml.rs diff --git a/src/commands/touch.rs b/crates/nu-cli/src/commands/touch.rs similarity index 100% rename from src/commands/touch.rs rename to crates/nu-cli/src/commands/touch.rs diff --git a/src/commands/trim.rs b/crates/nu-cli/src/commands/trim.rs similarity index 100% rename from src/commands/trim.rs rename to crates/nu-cli/src/commands/trim.rs diff --git a/src/commands/uniq.rs b/crates/nu-cli/src/commands/uniq.rs similarity index 100% rename from src/commands/uniq.rs rename to crates/nu-cli/src/commands/uniq.rs diff --git a/src/commands/version.rs b/crates/nu-cli/src/commands/version.rs similarity index 100% rename from src/commands/version.rs rename to crates/nu-cli/src/commands/version.rs diff --git a/src/commands/what.rs b/crates/nu-cli/src/commands/what.rs similarity index 100% rename from src/commands/what.rs rename to crates/nu-cli/src/commands/what.rs diff --git a/src/commands/where_.rs b/crates/nu-cli/src/commands/where_.rs similarity index 100% rename from src/commands/where_.rs rename to crates/nu-cli/src/commands/where_.rs diff --git a/src/commands/which_.rs b/crates/nu-cli/src/commands/which_.rs similarity index 100% rename from src/commands/which_.rs rename to crates/nu-cli/src/commands/which_.rs diff --git a/src/commands/wrap.rs b/crates/nu-cli/src/commands/wrap.rs similarity index 100% rename from src/commands/wrap.rs rename to crates/nu-cli/src/commands/wrap.rs diff --git a/src/context.rs b/crates/nu-cli/src/context.rs similarity index 100% rename from src/context.rs rename to crates/nu-cli/src/context.rs diff --git a/src/data.rs b/crates/nu-cli/src/data.rs similarity index 100% rename from src/data.rs rename to crates/nu-cli/src/data.rs diff --git a/src/data/base.rs b/crates/nu-cli/src/data/base.rs similarity index 100% rename from src/data/base.rs rename to crates/nu-cli/src/data/base.rs diff --git a/src/data/base/shape.rs b/crates/nu-cli/src/data/base/shape.rs similarity index 100% rename from src/data/base/shape.rs rename to crates/nu-cli/src/data/base/shape.rs diff --git a/src/data/command.rs b/crates/nu-cli/src/data/command.rs similarity index 100% rename from src/data/command.rs rename to crates/nu-cli/src/data/command.rs diff --git a/src/data/config.rs b/crates/nu-cli/src/data/config.rs similarity index 100% rename from src/data/config.rs rename to crates/nu-cli/src/data/config.rs diff --git a/src/data/config/conf.rs b/crates/nu-cli/src/data/config/conf.rs similarity index 100% rename from src/data/config/conf.rs rename to crates/nu-cli/src/data/config/conf.rs diff --git a/src/data/config/nuconfig.rs b/crates/nu-cli/src/data/config/nuconfig.rs similarity index 100% rename from src/data/config/nuconfig.rs rename to crates/nu-cli/src/data/config/nuconfig.rs diff --git a/src/data/config/tests.rs b/crates/nu-cli/src/data/config/tests.rs similarity index 100% rename from src/data/config/tests.rs rename to crates/nu-cli/src/data/config/tests.rs diff --git a/src/data/dict.rs b/crates/nu-cli/src/data/dict.rs similarity index 100% rename from src/data/dict.rs rename to crates/nu-cli/src/data/dict.rs diff --git a/src/data/files.rs b/crates/nu-cli/src/data/files.rs similarity index 100% rename from src/data/files.rs rename to crates/nu-cli/src/data/files.rs diff --git a/src/data/operators.rs b/crates/nu-cli/src/data/operators.rs similarity index 100% rename from src/data/operators.rs rename to crates/nu-cli/src/data/operators.rs diff --git a/src/data/primitive.rs b/crates/nu-cli/src/data/primitive.rs similarity index 100% rename from src/data/primitive.rs rename to crates/nu-cli/src/data/primitive.rs diff --git a/src/data/process.rs b/crates/nu-cli/src/data/process.rs similarity index 100% rename from src/data/process.rs rename to crates/nu-cli/src/data/process.rs diff --git a/src/data/types.rs b/crates/nu-cli/src/data/types.rs similarity index 100% rename from src/data/types.rs rename to crates/nu-cli/src/data/types.rs diff --git a/src/data/value.rs b/crates/nu-cli/src/data/value.rs similarity index 100% rename from src/data/value.rs rename to crates/nu-cli/src/data/value.rs diff --git a/src/deserializer.rs b/crates/nu-cli/src/deserializer.rs similarity index 100% rename from src/deserializer.rs rename to crates/nu-cli/src/deserializer.rs diff --git a/src/env.rs b/crates/nu-cli/src/env.rs similarity index 100% rename from src/env.rs rename to crates/nu-cli/src/env.rs diff --git a/src/env/environment.rs b/crates/nu-cli/src/env/environment.rs similarity index 100% rename from src/env/environment.rs rename to crates/nu-cli/src/env/environment.rs diff --git a/src/env/environment_syncer.rs b/crates/nu-cli/src/env/environment_syncer.rs similarity index 100% rename from src/env/environment_syncer.rs rename to crates/nu-cli/src/env/environment_syncer.rs diff --git a/src/env/host.rs b/crates/nu-cli/src/env/host.rs similarity index 100% rename from src/env/host.rs rename to crates/nu-cli/src/env/host.rs diff --git a/src/evaluate/evaluate_args.rs b/crates/nu-cli/src/evaluate/evaluate_args.rs similarity index 100% rename from src/evaluate/evaluate_args.rs rename to crates/nu-cli/src/evaluate/evaluate_args.rs diff --git a/src/evaluate/evaluator.rs b/crates/nu-cli/src/evaluate/evaluator.rs similarity index 100% rename from src/evaluate/evaluator.rs rename to crates/nu-cli/src/evaluate/evaluator.rs diff --git a/src/evaluate/mod.rs b/crates/nu-cli/src/evaluate/mod.rs similarity index 100% rename from src/evaluate/mod.rs rename to crates/nu-cli/src/evaluate/mod.rs diff --git a/src/evaluate/operator.rs b/crates/nu-cli/src/evaluate/operator.rs similarity index 100% rename from src/evaluate/operator.rs rename to crates/nu-cli/src/evaluate/operator.rs diff --git a/src/evaluate/variables.rs b/crates/nu-cli/src/evaluate/variables.rs similarity index 100% rename from src/evaluate/variables.rs rename to crates/nu-cli/src/evaluate/variables.rs diff --git a/src/format.rs b/crates/nu-cli/src/format.rs similarity index 100% rename from src/format.rs rename to crates/nu-cli/src/format.rs diff --git a/src/format/entries.rs b/crates/nu-cli/src/format/entries.rs similarity index 100% rename from src/format/entries.rs rename to crates/nu-cli/src/format/entries.rs diff --git a/src/format/generic.rs b/crates/nu-cli/src/format/generic.rs similarity index 100% rename from src/format/generic.rs rename to crates/nu-cli/src/format/generic.rs diff --git a/src/format/list.rs b/crates/nu-cli/src/format/list.rs similarity index 100% rename from src/format/list.rs rename to crates/nu-cli/src/format/list.rs diff --git a/src/format/table.rs b/crates/nu-cli/src/format/table.rs similarity index 100% rename from src/format/table.rs rename to crates/nu-cli/src/format/table.rs diff --git a/src/futures.rs b/crates/nu-cli/src/futures.rs similarity index 100% rename from src/futures.rs rename to crates/nu-cli/src/futures.rs diff --git a/src/git.rs b/crates/nu-cli/src/git.rs similarity index 100% rename from src/git.rs rename to crates/nu-cli/src/git.rs diff --git a/src/lib.rs b/crates/nu-cli/src/lib.rs similarity index 100% rename from src/lib.rs rename to crates/nu-cli/src/lib.rs diff --git a/src/prelude.rs b/crates/nu-cli/src/prelude.rs similarity index 100% rename from src/prelude.rs rename to crates/nu-cli/src/prelude.rs diff --git a/src/shell.rs b/crates/nu-cli/src/shell.rs similarity index 100% rename from src/shell.rs rename to crates/nu-cli/src/shell.rs diff --git a/src/shell/completer.rs b/crates/nu-cli/src/shell/completer.rs similarity index 100% rename from src/shell/completer.rs rename to crates/nu-cli/src/shell/completer.rs diff --git a/src/shell/filesystem_shell.rs b/crates/nu-cli/src/shell/filesystem_shell.rs similarity index 100% rename from src/shell/filesystem_shell.rs rename to crates/nu-cli/src/shell/filesystem_shell.rs diff --git a/src/shell/help_shell.rs b/crates/nu-cli/src/shell/help_shell.rs similarity index 100% rename from src/shell/help_shell.rs rename to crates/nu-cli/src/shell/help_shell.rs diff --git a/src/shell/helper.rs b/crates/nu-cli/src/shell/helper.rs similarity index 100% rename from src/shell/helper.rs rename to crates/nu-cli/src/shell/helper.rs diff --git a/src/shell/shell.rs b/crates/nu-cli/src/shell/shell.rs similarity index 100% rename from src/shell/shell.rs rename to crates/nu-cli/src/shell/shell.rs diff --git a/src/shell/shell_manager.rs b/crates/nu-cli/src/shell/shell_manager.rs similarity index 100% rename from src/shell/shell_manager.rs rename to crates/nu-cli/src/shell/shell_manager.rs diff --git a/src/shell/value_shell.rs b/crates/nu-cli/src/shell/value_shell.rs similarity index 100% rename from src/shell/value_shell.rs rename to crates/nu-cli/src/shell/value_shell.rs diff --git a/src/stream.rs b/crates/nu-cli/src/stream.rs similarity index 100% rename from src/stream.rs rename to crates/nu-cli/src/stream.rs diff --git a/src/utils.rs b/crates/nu-cli/src/utils.rs similarity index 98% rename from src/utils.rs rename to crates/nu-cli/src/utils.rs index 8a68a6ce32..0fddf91ff7 100644 --- a/src/utils.rs +++ b/crates/nu-cli/src/utils.rs @@ -170,16 +170,13 @@ mod tests { use super::{FileStructure, Res, ValueResource, ValueStructure}; use nu_protocol::{TaggedDictBuilder, UntaggedValue, Value}; use nu_source::Tag; + use nu_test_support::fs; use pretty_assertions::assert_eq; use std::path::PathBuf; fn fixtures() -> PathBuf { - let mut sdx = PathBuf::new(); - sdx.push("tests"); - sdx.push("fixtures"); - sdx.push("formats"); - - dunce::canonicalize(sdx).expect("Wrong path") + let fixtures = fs::fixtures().join("formats"); + dunce::canonicalize(fixtures).expect("Wrong path") } fn structured_sample_record(key: &str, value: &str) -> Value { diff --git a/src/utils/data_processing.rs b/crates/nu-cli/src/utils/data_processing.rs similarity index 100% rename from src/utils/data_processing.rs rename to crates/nu-cli/src/utils/data_processing.rs diff --git a/tests/commands/append.rs b/crates/nu-cli/tests/commands/append.rs similarity index 100% rename from tests/commands/append.rs rename to crates/nu-cli/tests/commands/append.rs diff --git a/tests/commands/calc.rs b/crates/nu-cli/tests/commands/calc.rs similarity index 100% rename from tests/commands/calc.rs rename to crates/nu-cli/tests/commands/calc.rs diff --git a/tests/commands/cd.rs b/crates/nu-cli/tests/commands/cd.rs similarity index 100% rename from tests/commands/cd.rs rename to crates/nu-cli/tests/commands/cd.rs diff --git a/tests/commands/compact.rs b/crates/nu-cli/tests/commands/compact.rs similarity index 100% rename from tests/commands/compact.rs rename to crates/nu-cli/tests/commands/compact.rs diff --git a/tests/commands/cp.rs b/crates/nu-cli/tests/commands/cp.rs similarity index 100% rename from tests/commands/cp.rs rename to crates/nu-cli/tests/commands/cp.rs diff --git a/tests/commands/default.rs b/crates/nu-cli/tests/commands/default.rs similarity index 100% rename from tests/commands/default.rs rename to crates/nu-cli/tests/commands/default.rs diff --git a/tests/commands/edit.rs b/crates/nu-cli/tests/commands/edit.rs similarity index 100% rename from tests/commands/edit.rs rename to crates/nu-cli/tests/commands/edit.rs diff --git a/tests/commands/enter.rs b/crates/nu-cli/tests/commands/enter.rs similarity index 100% rename from tests/commands/enter.rs rename to crates/nu-cli/tests/commands/enter.rs diff --git a/tests/commands/first.rs b/crates/nu-cli/tests/commands/first.rs similarity index 100% rename from tests/commands/first.rs rename to crates/nu-cli/tests/commands/first.rs diff --git a/tests/commands/format.rs b/crates/nu-cli/tests/commands/format.rs similarity index 100% rename from tests/commands/format.rs rename to crates/nu-cli/tests/commands/format.rs diff --git a/tests/commands/get.rs b/crates/nu-cli/tests/commands/get.rs similarity index 100% rename from tests/commands/get.rs rename to crates/nu-cli/tests/commands/get.rs diff --git a/tests/commands/group_by.rs b/crates/nu-cli/tests/commands/group_by.rs similarity index 100% rename from tests/commands/group_by.rs rename to crates/nu-cli/tests/commands/group_by.rs diff --git a/tests/commands/histogram.rs b/crates/nu-cli/tests/commands/histogram.rs similarity index 100% rename from tests/commands/histogram.rs rename to crates/nu-cli/tests/commands/histogram.rs diff --git a/tests/commands/insert.rs b/crates/nu-cli/tests/commands/insert.rs similarity index 100% rename from tests/commands/insert.rs rename to crates/nu-cli/tests/commands/insert.rs diff --git a/tests/commands/last.rs b/crates/nu-cli/tests/commands/last.rs similarity index 100% rename from tests/commands/last.rs rename to crates/nu-cli/tests/commands/last.rs diff --git a/tests/commands/lines.rs b/crates/nu-cli/tests/commands/lines.rs similarity index 100% rename from tests/commands/lines.rs rename to crates/nu-cli/tests/commands/lines.rs diff --git a/tests/commands/ls.rs b/crates/nu-cli/tests/commands/ls.rs similarity index 100% rename from tests/commands/ls.rs rename to crates/nu-cli/tests/commands/ls.rs diff --git a/tests/commands/mkdir.rs b/crates/nu-cli/tests/commands/mkdir.rs similarity index 100% rename from tests/commands/mkdir.rs rename to crates/nu-cli/tests/commands/mkdir.rs diff --git a/tests/commands/mod.rs b/crates/nu-cli/tests/commands/mod.rs similarity index 100% rename from tests/commands/mod.rs rename to crates/nu-cli/tests/commands/mod.rs diff --git a/tests/commands/mv.rs b/crates/nu-cli/tests/commands/mv.rs similarity index 100% rename from tests/commands/mv.rs rename to crates/nu-cli/tests/commands/mv.rs diff --git a/tests/commands/nth.rs b/crates/nu-cli/tests/commands/nth.rs similarity index 100% rename from tests/commands/nth.rs rename to crates/nu-cli/tests/commands/nth.rs diff --git a/tests/commands/open.rs b/crates/nu-cli/tests/commands/open.rs similarity index 100% rename from tests/commands/open.rs rename to crates/nu-cli/tests/commands/open.rs diff --git a/tests/commands/parse.rs b/crates/nu-cli/tests/commands/parse.rs similarity index 100% rename from tests/commands/parse.rs rename to crates/nu-cli/tests/commands/parse.rs diff --git a/tests/commands/pick.rs b/crates/nu-cli/tests/commands/pick.rs similarity index 100% rename from tests/commands/pick.rs rename to crates/nu-cli/tests/commands/pick.rs diff --git a/tests/commands/prepend.rs b/crates/nu-cli/tests/commands/prepend.rs similarity index 100% rename from tests/commands/prepend.rs rename to crates/nu-cli/tests/commands/prepend.rs diff --git a/tests/commands/range.rs b/crates/nu-cli/tests/commands/range.rs similarity index 100% rename from tests/commands/range.rs rename to crates/nu-cli/tests/commands/range.rs diff --git a/tests/commands/rename.rs b/crates/nu-cli/tests/commands/rename.rs similarity index 100% rename from tests/commands/rename.rs rename to crates/nu-cli/tests/commands/rename.rs diff --git a/tests/commands/reverse.rs b/crates/nu-cli/tests/commands/reverse.rs similarity index 100% rename from tests/commands/reverse.rs rename to crates/nu-cli/tests/commands/reverse.rs diff --git a/tests/commands/rm.rs b/crates/nu-cli/tests/commands/rm.rs similarity index 100% rename from tests/commands/rm.rs rename to crates/nu-cli/tests/commands/rm.rs diff --git a/tests/commands/save.rs b/crates/nu-cli/tests/commands/save.rs similarity index 100% rename from tests/commands/save.rs rename to crates/nu-cli/tests/commands/save.rs diff --git a/tests/commands/sort_by.rs b/crates/nu-cli/tests/commands/sort_by.rs similarity index 100% rename from tests/commands/sort_by.rs rename to crates/nu-cli/tests/commands/sort_by.rs diff --git a/tests/commands/split_by.rs b/crates/nu-cli/tests/commands/split_by.rs similarity index 100% rename from tests/commands/split_by.rs rename to crates/nu-cli/tests/commands/split_by.rs diff --git a/tests/commands/split_column.rs b/crates/nu-cli/tests/commands/split_column.rs similarity index 100% rename from tests/commands/split_column.rs rename to crates/nu-cli/tests/commands/split_column.rs diff --git a/tests/commands/touch.rs b/crates/nu-cli/tests/commands/touch.rs similarity index 100% rename from tests/commands/touch.rs rename to crates/nu-cli/tests/commands/touch.rs diff --git a/tests/commands/uniq.rs b/crates/nu-cli/tests/commands/uniq.rs similarity index 100% rename from tests/commands/uniq.rs rename to crates/nu-cli/tests/commands/uniq.rs diff --git a/tests/commands/where_.rs b/crates/nu-cli/tests/commands/where_.rs similarity index 100% rename from tests/commands/where_.rs rename to crates/nu-cli/tests/commands/where_.rs diff --git a/tests/commands/wrap.rs b/crates/nu-cli/tests/commands/wrap.rs similarity index 100% rename from tests/commands/wrap.rs rename to crates/nu-cli/tests/commands/wrap.rs diff --git a/tests/format_conversions/bson.rs b/crates/nu-cli/tests/format_conversions/bson.rs similarity index 100% rename from tests/format_conversions/bson.rs rename to crates/nu-cli/tests/format_conversions/bson.rs diff --git a/tests/format_conversions/csv.rs b/crates/nu-cli/tests/format_conversions/csv.rs similarity index 100% rename from tests/format_conversions/csv.rs rename to crates/nu-cli/tests/format_conversions/csv.rs diff --git a/tests/format_conversions/json.rs b/crates/nu-cli/tests/format_conversions/json.rs similarity index 100% rename from tests/format_conversions/json.rs rename to crates/nu-cli/tests/format_conversions/json.rs diff --git a/tests/format_conversions/mod.rs b/crates/nu-cli/tests/format_conversions/mod.rs similarity index 100% rename from tests/format_conversions/mod.rs rename to crates/nu-cli/tests/format_conversions/mod.rs diff --git a/tests/format_conversions/ods.rs b/crates/nu-cli/tests/format_conversions/ods.rs similarity index 100% rename from tests/format_conversions/ods.rs rename to crates/nu-cli/tests/format_conversions/ods.rs diff --git a/tests/format_conversions/sqlite.rs b/crates/nu-cli/tests/format_conversions/sqlite.rs similarity index 100% rename from tests/format_conversions/sqlite.rs rename to crates/nu-cli/tests/format_conversions/sqlite.rs diff --git a/tests/format_conversions/ssv.rs b/crates/nu-cli/tests/format_conversions/ssv.rs similarity index 100% rename from tests/format_conversions/ssv.rs rename to crates/nu-cli/tests/format_conversions/ssv.rs diff --git a/tests/format_conversions/toml.rs b/crates/nu-cli/tests/format_conversions/toml.rs similarity index 100% rename from tests/format_conversions/toml.rs rename to crates/nu-cli/tests/format_conversions/toml.rs diff --git a/tests/format_conversions/tsv.rs b/crates/nu-cli/tests/format_conversions/tsv.rs similarity index 100% rename from tests/format_conversions/tsv.rs rename to crates/nu-cli/tests/format_conversions/tsv.rs diff --git a/tests/format_conversions/url.rs b/crates/nu-cli/tests/format_conversions/url.rs similarity index 100% rename from tests/format_conversions/url.rs rename to crates/nu-cli/tests/format_conversions/url.rs diff --git a/tests/format_conversions/xlsx.rs b/crates/nu-cli/tests/format_conversions/xlsx.rs similarity index 100% rename from tests/format_conversions/xlsx.rs rename to crates/nu-cli/tests/format_conversions/xlsx.rs diff --git a/tests/format_conversions/yaml.rs b/crates/nu-cli/tests/format_conversions/yaml.rs similarity index 100% rename from tests/format_conversions/yaml.rs rename to crates/nu-cli/tests/format_conversions/yaml.rs diff --git a/crates/nu-cli/tests/main.rs b/crates/nu-cli/tests/main.rs new file mode 100644 index 0000000000..03fcbf2b1d --- /dev/null +++ b/crates/nu-cli/tests/main.rs @@ -0,0 +1,4 @@ +extern crate nu_test_support; + +mod commands; +mod format_conversions; diff --git a/crates/nu-test-support/src/fs.rs b/crates/nu-test-support/src/fs.rs index 9dcedd3557..be8287eddb 100644 --- a/crates/nu-test-support/src/fs.rs +++ b/crates/nu-test-support/src/fs.rs @@ -225,15 +225,41 @@ pub fn executable_path() -> PathBuf { path } +pub fn root() -> PathBuf { + let manifest_dir = if let Ok(manifest_dir) = std::env::var("CARGO_MANIFEST_DIR") { + PathBuf::from(manifest_dir) + } else { + PathBuf::from(env!("CARGO_MANIFEST_DIR")) + }; + + let test_path = manifest_dir.join("Cargo.lock"); + if test_path.exists() { + manifest_dir + } else { + manifest_dir + .parent() + .expect("Couldn't find the debug binaries directory") + .parent() + .expect("Couldn't find the debug binaries directory") + .to_path_buf() + } +} + pub fn binaries() -> PathBuf { - PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .parent() - .expect("Couldn't find the debug binaries directory") - .parent() - .expect("Couldn't find the debug binaries directory") - .join("target/debug") + root().join("target/debug") +} + +pub fn fixtures() -> PathBuf { + root().join("tests/fixtures") } pub fn in_directory(str: impl AsRef) -> String { - str.as_ref().display().to_string() + let path = str.as_ref(); + let path = if path.is_relative() { + root().join(path) + } else { + path.to_path_buf() + }; + + path.display().to_string() } diff --git a/crates/nu-test-support/src/playground.rs b/crates/nu-test-support/src/playground.rs index ccac984266..63adf5c9ac 100644 --- a/crates/nu-test-support/src/playground.rs +++ b/crates/nu-test-support/src/playground.rs @@ -1,4 +1,4 @@ -use crate::fs::line_ending; +use crate::fs; use crate::fs::Stub; use getset::Getters; @@ -52,17 +52,9 @@ impl Playground { cwd: nuplay_dir, }; - let project_root = PathBuf::from(env!("CARGO_MANIFEST_DIR")); let playground_root = playground.root.path(); - let fixtures = project_root; - let fixtures = fixtures - .parent() - .expect("Couldn't find the fixtures directory") - .parent() - .expect("Couldn't find the fixtures directory") - .join("tests/fixtures"); - + let fixtures = fs::fixtures(); let fixtures = dunce::canonicalize(fixtures.clone()).unwrap_or_else(|e| { panic!( "Couldn't canonicalize fixtures path {}: {:?}", @@ -104,7 +96,7 @@ impl Playground { } pub fn with_files(&mut self, files: Vec) -> &mut Self { - let endl = line_ending(); + let endl = fs::line_ending(); files .iter() diff --git a/docker/Dockerfile.nu-base b/docker/Dockerfile.nu-base index 3adee88e78..9a06b38e25 100644 --- a/docker/Dockerfile.nu-base +++ b/docker/Dockerfile.nu-base @@ -7,6 +7,7 @@ ENV DEBIAN_FRONTEND noninteractive RUN apt-get update && apt-get install -y libssl-dev \ libxcb-composite0-dev \ pkg-config \ + libx11-dev \ curl ARG RELEASE=false @@ -18,7 +19,7 @@ COPY . /code RUN echo "##vso[task.prependpath]/root/.cargo/bin" && \ rustc -Vv && \ if $RELEASE; then cargo build --release; \ - cp target/release/nu /usr/local/bin; \ + cp target/release/nu /usr/local/bin; \ else cargo build; \ cp target/debug/nu /usr/local/bin; fi; ENTRYPOINT ["nu"] diff --git a/src/main.rs b/src/main.rs index 6c48ffccb9..13953afa4f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -70,7 +70,7 @@ fn main() -> Result<(), Box> { None => {} Some(values) => { for item in values { - builder.filter_module(&format!("nu::{}", item), LevelFilter::Trace); + builder.filter_module(&format!("nu_cli::{}", item), LevelFilter::Trace); } } } @@ -79,7 +79,7 @@ fn main() -> Result<(), Box> { None => {} Some(values) => { for item in values { - builder.filter_module(&format!("nu::{}", item), LevelFilter::Debug); + builder.filter_module(&format!("nu_cli::{}", item), LevelFilter::Debug); } } } @@ -89,10 +89,10 @@ fn main() -> Result<(), Box> { match matches.values_of("commands") { None => {} Some(values) => { - let mut syncer = nu::EnvironmentSyncer::new(); - let mut context = nu::create_default_context(&mut syncer)?; + let mut syncer = nu_cli::EnvironmentSyncer::new(); + let mut context = nu_cli::create_default_context(&mut syncer)?; - let _ = nu::load_plugins(&mut context); + let _ = nu_cli::load_plugins(&mut context); let cc = context.ctrl_c.clone(); @@ -105,7 +105,7 @@ fn main() -> Result<(), Box> { context.ctrl_c.store(false, Ordering::SeqCst); } for item in values { - futures::executor::block_on(nu::run_pipeline_standalone( + futures::executor::block_on(nu_cli::run_pipeline_standalone( item.into(), matches.is_present("stdin"), &mut context, @@ -119,10 +119,10 @@ fn main() -> Result<(), Box> { Some(script) => { let file = File::open(script)?; let reader = BufReader::new(file); - let mut syncer = nu::EnvironmentSyncer::new(); - let mut context = nu::create_default_context(&mut syncer)?; + let mut syncer = nu_cli::EnvironmentSyncer::new(); + let mut context = nu_cli::create_default_context(&mut syncer)?; - let _ = nu::load_plugins(&mut context); + let _ = nu_cli::load_plugins(&mut context); let cc = context.ctrl_c.clone(); @@ -137,7 +137,7 @@ fn main() -> Result<(), Box> { for line in reader.lines() { let line = line?; if !line.starts_with('#') { - futures::executor::block_on(nu::run_pipeline_standalone( + futures::executor::block_on(nu_cli::run_pipeline_standalone( line, matches.is_present("stdin"), &mut context, @@ -152,7 +152,7 @@ fn main() -> Result<(), Box> { "Welcome to Nushell {} (type 'help' for more info)", clap::crate_version!() ); - futures::executor::block_on(nu::cli())?; + futures::executor::block_on(nu_cli::cli())?; } } diff --git a/tests/main.rs b/tests/main.rs index ea20e52593..77d5122457 100644 --- a/tests/main.rs +++ b/tests/main.rs @@ -1,6 +1,4 @@ extern crate nu_test_support; -mod commands; -mod format_conversions; mod plugins; mod shell;