Skip to content

Commit

Permalink
Check for empty args (don't hard-code arguments)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shai-Aviv committed Jan 24, 2021
1 parent 8925a1d commit b932f9f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .local/bin/set-theme
Expand Up @@ -165,9 +165,9 @@ def parseargs():
help='toggle the background between dark and light')
args = parser.parse_args()

if not args.theme and not args.toggle_bg:
print(f'{parser.prog}: error: '
'at least one of the arguments [THEME] [--toggle-bg] required',
if not any(vars(args).values()):
parser.print_usage(sys.stderr)
print(f'{parser.prog}: error: at least one argument is required',
file=sys.stderr)
sys.exit(2)

Expand Down

0 comments on commit b932f9f

Please sign in to comment.