Skip to content

Commit

Permalink
Add version switch to CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonacox committed Jan 6, 2025
1 parent fc832ce commit 6b92610
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tinytuya/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
# Options for all functions.
# Add both here and in subparsers (with alternate `dest=`) if you want to allow it to be positioned anywhere
parser.add_argument( '-debug', '-d', help='Enable debug messages', action='store_true' )
parser.add_argument( '-v', '--version', help='Display version information', action='store_true' )

subparser = parser.add_subparsers( dest='command', title='commands (run <command> -h to see usage information)' )
subparsers = {}
Expand Down Expand Up @@ -88,6 +89,10 @@

args = parser.parse_args()

if args.version:
print('TinyTuya version:', version)
sys.exit(0)

if args.debug:
print('Parsed args:', args)
set_debug(True)
Expand Down

0 comments on commit 6b92610

Please sign in to comment.