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

Optional naming of subcommands #34

Merged
merged 5 commits into from
Oct 31, 2024
Merged

Optional naming of subcommands #34

merged 5 commits into from
Oct 31, 2024

Conversation

gmertes
Copy link
Member

@gmertes gmertes commented Oct 30, 2024

This PR allows subcommands to have a different name than their file name via an optional attribute command

Usage:

# commands/mycommand.py
class MyCommand(Command):
   command = "fancy-command"

Will then become anemoi-package fancy-command instead of anemoi-package mycommand

If the command attribute is not present in the class, the filename is used. I suggest we use that as the default, and only add a command if an explicit rename is required.

@FussyDuck
Copy link

FussyDuck commented Oct 30, 2024

CLA assistant check
All committers have signed the CLA.

@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.40%. Comparing base (90b82bc) to head (7fe4fb6).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop      #34   +/-   ##
========================================
  Coverage    89.40%   89.40%           
========================================
  Files            5        5           
  Lines          151      151           
========================================
  Hits           135      135           
  Misses          16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

HCookie
HCookie previously approved these changes Oct 30, 2024
gmertes and others added 2 commits October 30, 2024 14:08
Co-authored-by: Jesper Dramsch <jesper.dramsch@ecmwf.int>
@gmertes gmertes force-pushed the feat/subcommand-name branch from 834c92e to 10029d1 Compare October 30, 2024 14:10
@gmertes gmertes changed the title Explicit naming of subcommands Optional naming of subcommands Oct 31, 2024
@gmertes gmertes marked this pull request as ready for review October 31, 2024 11:53
@gmertes
Copy link
Member Author

gmertes commented Oct 31, 2024

Following internal feedback, name was renamed to command.

Copy link

@anaprietonem anaprietonem left a comment

Choose a reason for hiding this comment

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

LGTM

@gmertes gmertes merged commit ba4279f into develop Oct 31, 2024
129 of 135 checks passed
@gmertes gmertes deleted the feat/subcommand-name branch October 31, 2024 15:11
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.

5 participants