diff options
| author | Simon <vesspa0330@gmail.com> | 2025-02-04 20:50:55 -0500 |
|---|---|---|
| committer | Simon <vesspa0330@gmail.com> | 2025-02-04 20:50:55 -0500 |
| commit | bd129f18a6caf47e04390cd9612075e465c6411f (patch) | |
| tree | f59f191d627ef7a728fca74babba57428819e784 /color-converter.py | |
| parent | fb628e5ba86060d7857045706c71259eebc5e9dc (diff) | |
added a license and a 'version' flag in anticipation of release
Diffstat (limited to 'color-converter.py')
| -rw-r--r-- | color-converter.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/color-converter.py b/color-converter.py index c5f683d..25565cd 100644 --- a/color-converter.py +++ b/color-converter.py @@ -1,6 +1,8 @@ +#!/usr/bin/env python3 import math import argparse +VERSION = 1.0 TYPES = ['hex', 'rgb', 'cmy', 'cmyk', 'hsl', 'hsv'] # look into LAB @@ -33,17 +35,23 @@ def main(): parser.add_argument('--output', '-o', help='the name of a file to store output in (will create file if doesn\'t exist, will OVERWRITE existing file\'s contents)') parser.add_argument('--append', '-a', action='store_true', help='append rather than overwrite when outputting to file rather than stdout') parser.add_argument('--verbose', '-v', action='store_true', help='print when performing conversions') + parser.add_argument('--version', action='store_true', help='print current version') parser.add_argument('color', nargs='*', help='a color in Hex, RGB, CMY, CMYK, HSL or HSV format') args = parser.parse_args() ''' PROCESS ARGS ''' + # simple version check + if args.version : + print('color-converter: CLI color code translator!') + print(' -- v.1.0 --- ') + # determine which conversions to perform outputFormats = [] flagsActive = 0 for flag in vars(args).keys() : - # if the flag for an output type is present, keep trac + # if an output format flag is present, keep track if (vars(args).get(flag, False)) and (flag in TYPES) : flagsActive += 1 outputFormats.append(flag) |
