2020-06-23 18:21:47 +00:00
# Contributing
2022-06-07 19:47:08 +00:00
Welcome to Nushell!
2020-04-11 18:52:53 +00:00
2020-04-11 18:54:16 +00: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 18:52:53 +00:00
2020-06-23 18:21:47 +00:00
## Developing
2022-06-07 19:47:08 +00:00
### Setup
2020-06-23 18:21:47 +00:00
2022-06-07 19:47:08 +00: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 00:20:55 +00:00
2020-06-23 18:21:47 +00:00
```bash
2020-04-24 00:20:55 +00:00
git clone https://github.com/nushell/nushell
cd nushell
cargo build
```
2020-06-23 18:21:47 +00:00
### Useful Commands
2020-04-24 00:20:55 +00:00
2020-08-30 03:33:28 +00:00
- Build and run Nushell:
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
```shell
2022-06-07 19:47:08 +00:00
cargo run
2020-08-30 03:33:28 +00:00
```
2020-05-24 17:34:26 +00:00
2022-06-07 19:47:08 +00:00
- Build and run with extra features. Currently extra features include dataframes and sqlite database support.
2020-10-08 02:14:59 +00:00
```shell
2022-06-07 19:47:08 +00:00
cargo run --features=extra
2020-10-08 02:14:59 +00:00
```
2020-08-30 03:33:28 +00:00
- Run Clippy on Nushell:
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
```shell
2022-06-07 19:47:08 +00:00
cargo clippy --workspace --features=extra -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect
2020-08-30 03:33:28 +00:00
```
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
- Run all tests:
2020-04-24 00:20:55 +00:00
2020-08-30 03:33:28 +00:00
```shell
2022-06-07 19:47:08 +00:00
cargo test --workspace --features=extra
2020-08-30 03:33:28 +00:00
```
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
- Run all tests for a specific command
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
```shell
cargo test --package nu-cli --test main -- commands::< command_name_here >
```
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
- Check to see if there are code formatting issues
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
```shell
cargo fmt --all -- --check
```
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
- Format the code in the project
2020-05-24 17:34:26 +00:00
2020-08-30 03:33:28 +00:00
```shell
cargo fmt --all
```
2020-10-08 02:14:59 +00:00
### Debugging Tips
- To view verbose logs when developing, enable the `trace` log level.
```shell
2022-06-07 19:47:08 +00:00
cargo run --release --features=extra -- --log-level trace
2020-10-08 02:14:59 +00:00
```
2022-08-11 06:10:27 +00: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
2022-08-20 01:06:45 +00:00
open $"($nu.temp-path)/nu-($nu.pid).log"
2022-08-11 06:10:27 +00:00
```