Skip to content

Commit c5f4e29

Browse files
author
Tage Johansson
committed
Added aliases for subcommands of the comment command.
1 parent ac20315 commit c5f4e29

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Added
11+
12+
- Added the aliases "sh", "s", and "e" to the "show", "set", and "edit" subcommands of the comment
13+
command respectively.
14+
15+
### Fixed
16+
17+
- Solve a bug which incorrectly raised an assertion when moves like "nbd2" were entered.
18+
1019
## [0.6.0] - 2024-08-22
1120

1221
### Added

chess_cli/curr_move_cmds.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,12 @@ def do_board(self, args) -> None:
170170
),
171171
)
172172
comment_subcmds = comment_argparser.add_subparsers(dest="subcmd")
173-
comment_subcmds.add_parser("show", help="Show the comment at the current move.")
173+
comment_subcmds.add_parser("show", aliases=["sh"], help="Show the comment at the current move.")
174174
comment_subcmds.add_parser("rm", help="Remove the comment at the current move.")
175-
comment_subcmds.add_parser("edit", help="Open the comment in your editor.")
176-
comment_set_argparser = comment_subcmds.add_parser("set", help="Set the comment for this move.")
175+
comment_subcmds.add_parser("edit", aliases=["e"], help="Open the comment in your editor.")
176+
comment_set_argparser = comment_subcmds.add_parser(
177+
"set", aliases=["s"], help="Set the comment for this move."
178+
)
177179
comment_set_argparser.add_argument("comment", help="The new text.")
178180
comment_append_argparser = comment_subcmds.add_parser(
179181
"append", help="Append text to the already existing comment."
@@ -201,18 +203,18 @@ def set_comment(new_comment: str) -> None:
201203
self.game_node.comment = new_comment
202204

203205
match args.subcmd:
204-
case "show" | None:
206+
case "show" | "sh" | None:
205207
self.poutput(comment)
206208
case "rm":
207209
set_comment("")
208-
case "set":
210+
case "set" | "s":
209211
new_comment = (
210212
args.comment if args.raw else update_comment_text(comment, args.comment)
211213
)
212214
set_comment(new_comment)
213215
case "append":
214216
set_comment(add_to_comment_text(comment, args.comment))
215-
case "edit":
217+
case "edit" | "e":
216218
fd, file_name = tempfile.mkstemp(suffix=".txt", text=True)
217219
try:
218220
with os.fdopen(fd, mode="w") as file:

0 commit comments

Comments
 (0)