mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* lint: simplify hooks already covered by Ruff * prune dev dependency * setting E, W, F * poetry? * autopep8 * quote-style = "single" * double-quote-string-fixer * --all-files * apply * Q * drop double-quote-string-fixer * --all-files * apply pre-commit * python3.11 -m poetry lock --no-update --------- Co-authored-by: Robert Brennan <accounts@rbren.io>
31 lines
1016 B
Python
31 lines
1016 B
Python
import sys
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) < 3:
|
|
print('Usage: python string_cli.py <command> <string>')
|
|
sys.exit(1)
|
|
|
|
command = sys.argv[1]
|
|
input_string = sys.argv[2]
|
|
|
|
if command == 'reverse':
|
|
from commands.reverse import reverse_string
|
|
print(reverse_string(input_string))
|
|
elif command == 'uppercase':
|
|
from commands.uppercase import to_uppercase
|
|
print(to_uppercase(input_string))
|
|
elif command == 'lowercase':
|
|
from commands.lowercase import to_lowercase
|
|
print(to_lowercase(input_string))
|
|
elif command == 'spongebob':
|
|
from commands.spongebob import spongebob_case
|
|
print(spongebob_case(input_string))
|
|
elif command == 'length':
|
|
from commands.length import string_length
|
|
print(string_length(input_string))
|
|
elif command == 'scramble':
|
|
from commands.scramble import scramble_string
|
|
print(scramble_string(input_string))
|
|
else:
|
|
print('Invalid command!')
|