Skip to content

Commit 4ff5066

Browse files
committed
Make default command accept same args as 'add' command
Now 'blurb -i 123' works the same as 'blurb add -i 123', because nobody expects the Spanish Inquisition... or having to type 'add' every time. - Forward all add command parameters to the default command - Update help text to indicate 'add' is the default command - Parameters like --issue, --section, and --rst-on-stdin now work directly with 'blurb' without specifying 'add'
1 parent 8217638 commit 4ff5066

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/blurb/blurb.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,11 @@ def add(*, issue: Annotated[Optional[str], Parameter(alias=["-i"])] = None,
912912
section: Annotated[Optional[str], Parameter(alias=["-s"])] = None,
913913
rst_on_stdin: bool = False):
914914
# This docstring template is formatted after the function definition.
915-
"""Add a new Misc/NEWS entry.
915+
"""Add a new Misc/NEWS entry (default command).
916916
917917
Opens an editor to create a new entry for Misc/NEWS unless all
918-
automation parameters are provided.
918+
automation parameters are provided. This is the default command when
919+
no subcommand is specified.
919920
920921
Use -i/--issue to specify a GitHub issue number or link.
921922
Use -s/--section to specify the NEWS section (case insensitive with partial matching).
@@ -1223,9 +1224,11 @@ def export():
12231224

12241225

12251226
@app.default
1226-
def default_command():
1227+
def default_command(*, issue: Annotated[Optional[str], Parameter(alias=["-i"])] = None,
1228+
section: Annotated[Optional[str], Parameter(alias=["-s"])] = None,
1229+
rst_on_stdin: bool = False):
12271230
"""Default to 'add' command when no subcommand specified."""
1228-
add()
1231+
add(issue=issue, section=section, rst_on_stdin=rst_on_stdin)
12291232

12301233

12311234
def main():

0 commit comments

Comments
 (0)