Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[keytool] use a table format output and add json output support #13196

Merged
merged 3 commits into from
Jul 28, 2023

Conversation

stefan-mysten
Copy link
Contributor

@stefan-mysten stefan-mysten commented Jul 27, 2023

Description

Revamp the keytool CLI command to pretty print output as formatted tables and add support for json output. This is the first experimental step to gain feedback before moving to other CLI commands.

The PR also removes seven commands that should not be part of the CLI and were OK'ed by @siomari and @ammn to be removed:

  • Base64PubKeyToAddress
  • BytesToBase64
  • Base64ToBytes
  • Base64ToHex
  • BytesToHex
  • HexToBase64
  • HexToBytes

Test Plan

Executed the existing tests.


If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

This PR modifies the CLI keytool as follows:

  • Adds support for json output. Use the --json flag when invoking any keytool command (such as keytool list --json).
  • Changes the default output to the terminal to formatted tables with headers to improve consistency across different commands. Use --json if you need to parse/pipe output data.
  • Removes the following seven commands, which you can replace by calls to the base64 and xxd utilities:
Base64PubKeyToAddress
BytesToBase64
Base64ToBytes
Base64ToHex -> input | base64 -d | xxd -p
BytesToHex
HexToBase64 -> input | xxd -r -p | base64
HexToBytes 

@stefan-mysten stefan-mysten requested a review from amnn July 27, 2023 23:34
@vercel
Copy link

vercel bot commented Jul 27, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
mysten-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2023 3:33pm
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2023 3:33pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Jul 28, 2023 3:33pm
multisig-toolkit ⬜️ Ignored (Inspect) Jul 28, 2023 3:33pm
sui-kiosk ⬜️ Ignored (Inspect) Jul 28, 2023 3:33pm
sui-wallet-kit ⬜️ Ignored (Inspect) Jul 28, 2023 3:33pm

Copy link
Contributor

@amnn amnn left a comment

Choose a reason for hiding this comment

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

PR content looks good, thanks @stefan-mysten!

On release notes, have a read of the release note guidelines I sent to redraft them. Include all the things that changed (the table and JSON formats, and dropping the encoding commands), with a brief explanation of how to use them (e.g. that table format is default, and JSON format is activated with --json), and if migration is required, a brief explanation of that as well (e.g. what to replace the hex conversion tools with).

Then, before landing, make sure @randall-Mysten or @ronny-mysten have had a chance to review the release notes as well.

crates/sui/src/keytool.rs Outdated Show resolved Hide resolved
@stefan-mysten stefan-mysten merged commit 1838e47 into MystenLabs:main Jul 28, 2023
36 checks passed
@stefan-mysten stefan-mysten deleted the keytool_revamp_pr branch July 28, 2023 17:56
ebmifa pushed a commit that referenced this pull request Aug 10, 2023
## Description 

Revamp the keytool CLI command to pretty print output as formatted
tables and add support for json output. This is the first experimental
step to gain feedback before moving to other CLI commands.

The PR also removes seven commands that should not be part of the CLI
and were OK'ed by @siomari and @ammn to be removed:
* Base64PubKeyToAddress
* BytesToBase64
* Base64ToBytes
* Base64ToHex
* BytesToHex
* HexToBase64
* HexToBytes

## Test Plan 

Executed the existing tests. 

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [x] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
This PR modifies the `CLI keytool` as follows:
* Adds support for `json` output. Use the `--json` flag when invoking
any `keytool` command (such as `keytool list --json`).
* Changes the default output to the terminal to formatted tables with
headers to improve consistency across different commands. Use `--json`
if you need to parse/pipe output data.
* Removes the following seven commands, which you can replace by calls
to the `base64` and `xxd` utilities:
```
Base64PubKeyToAddress
BytesToBase64
Base64ToBytes
Base64ToHex -> input | base64 -d | xxd -p
BytesToHex
HexToBase64 -> input | xxd -r -p | base64
HexToBytes 
```
amnn pushed a commit that referenced this pull request Aug 11, 2023
…upport (#13196)

Revamp the keytool CLI command to pretty print output as formatted
tables and add support for json output. This is the first experimental
step to gain feedback before moving to other CLI commands.

The PR also removes seven commands that should not be part of the CLI
and were OK'ed by @siomari and @ammn to be removed:
* Base64PubKeyToAddress
* BytesToBase64
* Base64ToBytes
* Base64ToHex
* BytesToHex
* HexToBase64
* HexToBytes

Executed the existing tests.

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

- [ ] protocol change
- [x] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

This PR modifies the `CLI keytool` as follows:
* Adds support for `json` output. Use the `--json` flag when invoking
any `keytool` command (such as `keytool list --json`).
* Changes the default output to the terminal to formatted tables with
headers to improve consistency across different commands. Use `--json`
if you need to parse/pipe output data.
* Removes the following seven commands, which you can replace by calls
to the `base64` and `xxd` utilities:
```
Base64PubKeyToAddress
BytesToBase64
Base64ToBytes
Base64ToHex -> input | base64 -d | xxd -p
BytesToHex
HexToBase64 -> input | xxd -r -p | base64
HexToBytes
```
amnn added a commit that referenced this pull request Aug 12, 2023
…upport (#13374)

## Description 

Original PR: #13196 

Revamp the keytool CLI command to pretty print output as formatted
tables and add support for json output. This is the first experimental
step to gain feedback before moving to other CLI commands.

The PR also removes seven commands that should not be part of the CLI
and were OK'ed by @siomari and @ammn to be removed:
* Base64PubKeyToAddress
* BytesToBase64
* Base64ToBytes
* Base64ToHex
* BytesToHex
* HexToBase64
* HexToBytes

## Test Plan 

Executed the existing tests.

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [x] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes

This PR modifies the `CLI keytool` as follows:
* Adds support for `json` output. Use the `--json` flag when invoking
any `keytool` command (such as `keytool list --json`).
* Changes the default output to the terminal to formatted tables with
headers to improve consistency across different commands. Use `--json`
if you need to parse/pipe output data.
* Removes the following seven commands, which you can replace by calls
to the `base64` and `xxd` utilities:
```
Base64PubKeyToAddress
BytesToBase64
Base64ToBytes
Base64ToHex -> input | base64 -d | xxd -p
BytesToHex
HexToBase64 -> input | xxd -r -p | base64
HexToBytes
```

---------

Co-authored-by: stefan-mysten <135084671+stefan-mysten@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants