ockam icon indicating copy to clipboard operation
ockam copied to clipboard

Use `Terminal` to print output instead of `println` in the `secure-channel delete` command

Open adrianbenavides opened this issue 1 year ago • 6 comments

Current behavior

The secure-channel show command is using println to print the command's output, which is a strategy that is being deprecated.

Desired behavior

Instead, the Terminal struct should be used to handle the output of every command.

Implementation details

The following function should be refactored:

https://github.com/build-trust/ockam/blob/9c49e470a574d91854aa24628584eda4554aaad0/implementations/rust/ockam/ockam_command/src/secure_channel/delete.rs#L49

You have to extract the printed contents into two variables (one for plain and another for json) and use the Terminal` struct as follows to print the command output:

opts.terminal
    .stdout()
    .plain(plain)
    .json(json)
    .write_line()?;

Some tips for newcomers:

  1. Create a new branch for the issue you are working on (don't push directly to your fork's develop branch)
  2. Run cargo fmt. You can configure the editor to run it automatically everytime a file is saved
  3. Run cargo clippy to make sure the code compiles + follows rust standards/best practices
  4. You don't need to keep your branch updated with develop until there is a merge conflict. If you still want to update it, use git rebase develop instead of gir merge develop

We love helping new contributors! ❤️ If you have questions or need help as you explore, please join us on Discord. If you're looking for other issues to contribute to, please checkout our good first issues.

adrianbenavides avatar Oct 17 '23 08:10 adrianbenavides