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

Improve CLI Text by Adding Verbose Text for Commands #68

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rtadepalli
Copy link

@rtadepalli rtadepalli commented Mar 2, 2024

Add some verbose descriptions (similar to PyIceberg) for the CLI options when iceberg --help is used.

Closes #61

iceberg list [options] [PARENT]
iceberg describe [options] [namespace | table] IDENTIFIER
iceberg (schema | spec | uuid | location) [options] TABLE_ID
iceberg drop [options] (namespace | table) IDENTIFIER
Copy link
Author

Choose a reason for hiding this comment

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

Kept the existing set of usages because this line for example has iceberg command [options] namespace and then an argument -- the namespace part isn't fully captured in the iceberg command [options] [arguments] format. Thought it'd be better to just leave these as examples.

@rtadepalli
Copy link
Author

@zeroshade can you please take a look at this?

iceberg properties [options] set (namespace | table) IDENTIFIER PROPNAME VALUE
iceberg properties [options] remove (namespace | table) IDENTIFIER PROPNAME
iceberg -h | --help | --version
iceberg [command] [options] [arguments]
Copy link
Member

Choose a reason for hiding this comment

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

does this actually work? The library being used docopt actually uses the usage string to perform the parsing and processing. [options] is a special handle thing for docopt, but i don't think that [command] and [arguments] is. So i think this might break the CLI here

Copy link
Author

Choose a reason for hiding this comment

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

@zeroshade Apologies, this slipped through my radar. I don't think that this is breaking the CLI:

~/Software/iceberg-go/cmd/iceberg (improve-cli-help-text*) » ./iceberg --help                                                                                                                             ramasai@Ramasais-MacBook-Air
iceberg.

Usage:
  iceberg [command] [options] [arguments]
  iceberg -h | --help
  iceberg --version

Commands:
  describe    Describe a namespace or a table.
  list        List tables or namespaces.
  schema      Get the schema of the table.
  spec        Return the partition spec of the table.
  uuid        Return the UUID of the table.
  location    Return the location of the table.
  drop        Operations to drop a namespace or table.
  files       List all the files of the table.
  rename      Rename a table.
  properties  Properties on tables/namespaces.

Arguments:
  PARENT         Catalog parent namespace
  IDENTIFIER     fully qualified namespace or table
  TABLE_ID       full path to a table
  PROPNAME       name of a property
  VALUE          value to set

Options:
  --catalog TEXT     specify the catalog type [default: rest]
  --uri TEXT         specify the catalog URI
  --output TYPE      output type (json/text) [default: text]
  --credential TEXT  specify credentials for the catalog
  --warehouse TEXT   specify the warehouse to use

Example Usages
  iceberg list [options] [PARENT]
  iceberg describe [options] [namespace | table] IDENTIFIER
  iceberg (schema | spec | uuid | location) [options] TABLE_ID
  iceberg drop [options] (namespace | table) IDENTIFIER
  iceberg files [options] TABLE_ID [--history]
  iceberg rename [options] <from> <to>
  iceberg properties [options] get (namespace | table) IDENTIFIER [PROPNAME]
  iceberg properties [options] set (namespace | table) IDENTIFIER PROPNAME VALUE
  iceberg properties [options] remove (namespace | table) IDENTIFIER PROPNAME

I tested this before putting up the PR -- unless I am misunderstanding what you mean?

Copy link
Member

Choose a reason for hiding this comment

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

That's for the help, did you confirm that it works just fine for the regular usages of calling list/describe/files/etc.? it's just a usage for docopt i hadnt seen before

@zeroshade
Copy link
Member

@rtadepalli I like the idea in general, but could you address my question when you have a chance?

@rtadepalli rtadepalli requested a review from zeroshade May 22, 2024 01:14
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.

Improve help text for CLI
2 participants