Update implementing_a_command.md (#3848)

+  nu-command/src/command.rs has been modified to nu-command/src/mod.rs in nowable version
This commit is contained in:
ken.chen 2021-07-27 22:03:52 +08:00 committed by GitHub
parent e4c282f0a6
commit ea42a84a4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,7 +86,7 @@ pub struct Command;
Before registering it to the context you need to make it available by declaring the module and re-export it in `crates/nu-command/src/commands.rs`. The commands we write are modules already (`take_two.rs` is the `take_two` module). In case you are not familiar with rust modules [read this refresher](https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html). Let's go ahead and declare it and then re-export the command's `Command` struct as `TakeTwo`, like so:
_nu-command/src/commands.rs_
_nu-command/src/mod.rs_
```rust
# ...
pub(crate) mod take_two;
@ -267,4 +267,4 @@ Not bad. We created first a list of int values and took two of them. Let's creat
───┴──────────
```
The command is ready.
The command is ready.