Skip to content

Commit 4bc3674

Browse files
committed
Fix an edge case in cmd_as_argument example for empty string after strip
Also: - Make some documentation more consistent with the example it was referring to
1 parent c9cd13b commit 4bc3674

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

docs/features/os.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ example. Using this methodology you can call it like so:
120120

121121
$ uv run examples/argparse_example.py -c blue help
122122

123-
Check the source code of this example, especially the `if __name__ == '__main__':` block, to see the
123+
Check the source code of this example, especially the `if __name__ == "__main__":` block, to see the
124124
technique.
125125

126126
### Automating cmd2 apps from other CLI/CLU tools

examples/cmd_as_argument.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def do_speak(self, args) -> None:
5050
words = []
5151
for w in args.words:
5252
word = w.strip()
53-
if args.piglatin:
53+
if args.piglatin and word:
5454
word = f"{word[1:]}{word[0]}ay"
5555
if args.shout:
5656
word = word.upper()

0 commit comments

Comments
 (0)