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

use subcommands in CLI #77

Open
ricardogsilva opened this issue Jan 3, 2025 · 2 comments · May be fixed by #86
Open

use subcommands in CLI #77

ricardogsilva opened this issue Jan 3, 2025 · 2 comments · May be fixed by #86
Assignees
Milestone

Comments

@ricardogsilva
Copy link
Collaborator

As GeoServer has a large REST API and since we may also be adding additional features in the future, let's organize our CLI client in a hierarchical way, grouping commands in some logical sense. Perhaps starting out by mimicking the sections that exist on the GeoServer UI (layers, stores, workspaces, etc.).

We can use typer subcommands for this. The end result would look something like this:

# main help would show a list of subcommands
gsx --help

 _Commands__________________________________________
| layer               Layer management commands           
| store               Store management commands            
| workspace           Workspace management commands  
|____________________________________________________
# subcommand help shows a list of commands
gsx layer --help

 _Commands__________________________________________
| add                Add a new layer           
| edit               Edit existing layer            
| delete             Delete existing layer  
|____________________________________________________
@ricardogsilva ricardogsilva converted this from a draft issue Jan 3, 2025
@ricardogsilva ricardogsilva moved this from Backlog to Todo in geoserverx Jan 3, 2025
@krishnaglodha krishnaglodha added this to the Jan 2025 milestone Jan 3, 2025
@krishnaglodha
Copy link
Collaborator

Let me know if following commands look good to you @ricardogsilva

gsx --help              
Usage: gsx [OPTIONS] COMMAND [ARGS]...

  GeoserverX CLI tools to talk to Geoserver efficiently .

Options:
  --install-completion [bash|zsh|fish|powershell|pwsh]
                                  Install completion for the specified shell.
  --show-completion [bash|zsh|fish|powershell|pwsh]
                                  Show completion for the specified shell, to
                                  copy it or customize the installation.
  --help                          Show this message and exit.

Commands:
  geofence
  layer
  misc
  style
  workspace
  • geofence
gsx geofence --help
Usage: gsx geofence [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  all-rules    Get all geofence rules in the Geoserver
  single-rule  Get geofence rule in the Geoserver
  • layer
gsx layer --help   
Usage: gsx layer [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  all           Get all layers in the Geoserver
  layer-groups  Get layer groups in the Geoserver
  single        Get layer in the Geoserver
  • misc
gsx misc --help 
Usage: gsx misc [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  create-file      Create Vector Layer in Geoserver
  create-pg-store  Create PostgreSQL store in Geoserver
  raster-st-wp     Get raster stores in specific workspaces
  raster-store     Get raster store information in specific workspaces
  vector-st-wp     Get vector stores in specific workspaces
  vector-store     Get vector store information in specific workspaces
  • style
gsx style --help
Usage: gsx style [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  all     Get all styles in Geoserver
  single  Get style in Geoserver
  • workspace
 gsx workspace --help
Usage: gsx workspace [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  all     Get all workspaces in the Geoserver
  create  Add workspace in the Geoserver
  delete  Delete workspace in the Geoserver
  single  Get workspace in the Geoserver
  update  Add workspace in the Geoserver

@ricardogsilva
Copy link
Collaborator Author

I would avoid having too generic categories such as misc. This ends up being obscure and forcing users to go inside misc to see what is there. If you see no good place for a command, then leave it at the top level for now - we can find somewhere to put it later.

It seems a good place to put those commands that deal with geoserver stores would be an additional store subcommand.

Furthermore:

  • instead of all, let's rather use list - let's keep command names as actions rather than nouns.
  • instead of single let's rather use get

@ricardogsilva ricardogsilva removed their assignment Jan 3, 2025
@krishnaglodha krishnaglodha moved this from Todo to In review in geoserverx Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

Successfully merging a pull request may close this issue.

2 participants