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 2 years 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

Can I work on it?

Tashuuuu avatar Oct 17 '23 09:10 Tashuuuu

can I work on this?

abhi-yo avatar Oct 17 '23 10:10 abhi-yo

@adrianbenavides this sounds interesting can u assign this to me ?

ironspec07 avatar Oct 17 '23 11:10 ironspec07

@abhi-yo That's awesome, this is all yours. Please let us know if you have any questions as you explore. You can also ask questions on the contributors discord https://discord.gg/RAbjRr3kds

nazmulidris avatar Oct 17 '23 15:10 nazmulidris

If this issue is still prevalent I can start working on this right now.

Jackbaude avatar Jun 13 '24 20:06 Jackbaude

This command was already refactored, but there is another one that needs the same fix: tcp-connection show. Check it out and let me know if you have nay questions. I can also create a new issue for this if you want

adrianbenavides avatar Jun 14 '24 12:06 adrianbenavides