2020-06-23 20:21:47 +02:00
# Contributing
2022-06-07 21:47:08 +02:00
Welcome to Nushell!
2020-04-11 20:52:53 +02:00
2020-04-11 20:54:16 +02:00
To get live support from the community see our [Discord ](https://discordapp.com/invite/NtAbbGn ), [Twitter ](https://twitter.com/nu_shell ) or file an issue or feature request here on [GitHub ](https://github.com/nushell/nushell/issues/new/choose )!
2020-04-11 20:52:53 +02:00
2020-06-23 20:21:47 +02:00
## Developing
2022-06-07 21:47:08 +02:00
### Setup
2020-06-23 20:21:47 +02:00
2022-06-07 21:47:08 +02:00
Nushell requires a recent Rust toolchain and some dependencies; [refer to the Nu Book for up-to-date requirements ](https://www.nushell.sh/book/installation.html#build-from-source ). After installing dependencies, you should be able to clone+build Nu like any other Rust project:
2020-04-24 02:20:55 +02:00
2020-06-23 20:21:47 +02:00
```bash
2020-04-24 02:20:55 +02:00
git clone https://github.com/nushell/nushell
cd nushell
cargo build
```
2020-06-23 20:21:47 +02:00
### Useful Commands
2020-04-24 02:20:55 +02:00
2020-08-30 05:33:28 +02:00
- Build and run Nushell:
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
```shell
2022-06-07 21:47:08 +02:00
cargo run
2020-08-30 05:33:28 +02:00
```
2020-05-24 19:34:26 +02:00
2022-06-07 21:47:08 +02:00
- Build and run with extra features. Currently extra features include dataframes and sqlite database support.
2020-10-08 04:14:59 +02:00
```shell
2022-06-07 21:47:08 +02:00
cargo run --features=extra
2020-10-08 04:14:59 +02:00
```
2020-08-30 05:33:28 +02:00
- Run Clippy on Nushell:
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
```shell
2022-06-07 21:47:08 +02:00
cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect
2020-08-30 05:33:28 +02:00
```
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
- Run all tests:
2020-04-24 02:20:55 +02:00
2020-08-30 05:33:28 +02:00
```shell
2022-06-07 21:47:08 +02:00
cargo test --workspace --features=extra
2020-08-30 05:33:28 +02:00
```
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
- Run all tests for a specific command
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
```shell
cargo test --package nu-cli --test main -- commands::< command_name_here >
```
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
- Check to see if there are code formatting issues
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
```shell
cargo fmt --all -- --check
```
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
- Format the code in the project
2020-05-24 19:34:26 +02:00
2020-08-30 05:33:28 +02:00
```shell
cargo fmt --all
```
2020-10-08 04:14:59 +02:00
### Debugging Tips
- To view verbose logs when developing, enable the `trace` log level.
```shell
2022-06-07 21:47:08 +02:00
cargo run --release --features=extra -- --log-level trace
2020-10-08 04:14:59 +02:00
```
2022-08-11 08:10:27 +02:00
- To redirect trace logs to a file, enable the `--log-target file` switch.
```shell
cargo run --release --features=extra -- --log-level trace --log-target file
[($nu.temp-path) nu-($nu.pid).log] | path join | open
```