Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Add public key address export subcommand #888

Conversation

NicolasMassart
Copy link
Contributor

@NicolasMassart NicolasMassart commented Feb 18, 2019

PR description

Add pantheon public-key export-address [--to=file] subcommand to write the node address to standard output or into a file.

Also changes the --to option of public key export (the other subcommand) to behave the same way with optional --to option.

Fixed Issue(s)

fixes PAN-2319

@NicolasMassart NicolasMassart added enhancement New feature or request work in progress Work on this pull request is ongoing documentation Related to any type of documentation api Related to public APIs labels Feb 18, 2019
@NicolasMassart NicolasMassart self-assigned this Feb 18, 2019
Copy link
Contributor

@ekellstrand ekellstrand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option: If you are so inclined, consider including PAN-1804 as it is very similar to this issue.

* address in the file. A direct output of the address to standard out is not done because we
* don't want the address value to be polluted by other information like logs that are in
* KeyPairUtil that is inevitable.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: by default, print to stdout. That's pretty standard syntax for something like this. Let the user choose to add the file option if they want. I suspect a valuable use case is scripting (eg startup script) where user would rather grab from stdout (and run through grep if necessary). Dealing with files can be a PITA, depending on installation (permissions, stale file, stale file that doesn't get updated and thus user gets broken value)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes but doesn't work as we output all logs to standard out. Files are way more easy to use just a cat and you got the content.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment in --to, if we make it optional we can default to std out. Do we have any CLI guidelines on positional parameters? That would be another option. Another option is to add another flag like --to-console and require one of those two flags.

However I think there should be some way to get it to output to console. The ease of use and default setting I am flexible on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree on making the --to file optional

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--to is now optional. I also made the change on the other one. It's retro-compatible with the previous way to use the commands.


@Option(
names = "--to",
required = true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: AFAIK: "--to" is not a standard name for output file. If you agree, consider using "-o / --out" instead as I think it is more common.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it's in our cli guidelines and how other commands works so we have to be consistant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--to is our CLI guideline.

I would recommend making it not required and in it's absence outputting to System.out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm in agreement with @shemnon. Using --to and if it's not specified output to the console.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--to is now optional. I also made the change on the other one. It's retro-compatible with the previous way to use the commands.

@NicolasMassart NicolasMassart removed the work in progress Work on this pull request is ongoing label Feb 19, 2019
@NicolasMassart NicolasMassart merged commit ddeace2 into PegaSysEng:master Feb 21, 2019
Errorific pushed a commit that referenced this pull request Mar 7, 2019
add public key address export subcommand
make the file output optional and write to standard output by default
code, tests and doc changes
@NicolasMassart NicolasMassart deleted the feature/PAN-2273_pub_key_to_addr branch March 12, 2019 16:24
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api Related to public APIs documentation Related to any type of documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants