package
This commit is contained in:
parent
3eccd76e8c
commit
2eb71e6412
14 changed files with 0 additions and 0 deletions
97
mrmp/arguments.py
Normal file
97
mrmp/arguments.py
Normal file
|
@ -0,0 +1,97 @@
|
|||
import argparse
|
||||
import os
|
||||
|
||||
import architecture
|
||||
import remote as r
|
||||
import subsystem
|
||||
|
||||
ACTION = 'action'
|
||||
ARCHITECTURES = 'architectures'
|
||||
COMPRESSION = 'compression'
|
||||
DIRECTORY = 'directory'
|
||||
FILESYSTEM = 'filesystem'
|
||||
REMOTE = 'remote'
|
||||
SUBSYSTEMS = 'subsystems'
|
||||
TEMPORARY = 'temporary'
|
||||
THREADS = 'threads'
|
||||
VERBOSE = 'verbose'
|
||||
|
||||
|
||||
class Formatter(argparse.RawTextHelpFormatter,
|
||||
argparse.ArgumentDefaultsHelpFormatter):
|
||||
pass
|
||||
|
||||
|
||||
def parse():
|
||||
parser = argparse.ArgumentParser(formatter_class=Formatter)
|
||||
|
||||
parser.add_argument(f'-{VERBOSE[0]}', f'--{VERBOSE}', type=bool, help='''\
|
||||
verbose output
|
||||
''')
|
||||
|
||||
parser.add_argument(f'-{DIRECTORY[0]}', f'--{DIRECTORY}', type=str,
|
||||
help='''\
|
||||
msys repository's directory
|
||||
''')
|
||||
parser.add_argument(f'--{TEMPORARY}', type=str, help='''\
|
||||
msys repository's temporary directory
|
||||
''')
|
||||
parser.add_argument(f'-{THREADS[0]}', f'--{THREADS}', type=int, help='''\
|
||||
number of threads to use
|
||||
''')
|
||||
parser.add_argument(f'{ACTION}', type=str, nargs='?',
|
||||
choices=['build', 'check', 'info', 'sync'], help='''\
|
||||
action to perform onto msys repository
|
||||
''')
|
||||
|
||||
sync = parser.add_argument_group('sync')
|
||||
sync.add_argument(f'-{REMOTE[0]}', f'--{REMOTE}', type=str, help='''\
|
||||
msys remote repository's location
|
||||
''')
|
||||
sync.add_argument(f'-{ARCHITECTURES[0]}', f'--{ARCHITECTURES}', type=str,
|
||||
nargs='+', choices=architecture.ARCHITECTURES.keys(),
|
||||
help='''\
|
||||
list of architectures to sync
|
||||
''')
|
||||
sync.add_argument(f'-{SUBSYSTEMS[0]}', f'--{SUBSYSTEMS}', type=str,
|
||||
nargs='+', choices=subsystem.FAMILIES, help='''\
|
||||
list of subsystems to sync
|
||||
''')
|
||||
|
||||
build = parser.add_argument_group('build')
|
||||
parser.add_argument(f'-{FILESYSTEM[0]}', f'--{FILESYSTEM}', type=str,
|
||||
help='''\
|
||||
directory containing modifications applying to filesystem
|
||||
''')
|
||||
build.add_argument(f'-{COMPRESSION[0]}', f'--{COMPRESSION}', type=str,
|
||||
choices=['gz', 'xz', 'zst'], help='''\
|
||||
compression applying to archive
|
||||
''')
|
||||
|
||||
parser.set_defaults(
|
||||
directory=os.curdir,
|
||||
temporary='tmp',
|
||||
threads=2,
|
||||
|
||||
action='info',
|
||||
|
||||
remote=r.MAIN,
|
||||
architectures=[architecture.MAIN],
|
||||
subsystems=[subsystem.MAIN, 'mingw'],
|
||||
|
||||
filesystem='fs',
|
||||
compression='zst',
|
||||
)
|
||||
|
||||
return vars(parser.parse_args())
|
||||
|
||||
|
||||
D = parse()
|
||||
|
||||
action = D[ACTION]
|
||||
architectures = D[ARCHITECTURES]
|
||||
directory = D[DIRECTORY]
|
||||
remote = D[REMOTE]
|
||||
subsystems = D[SUBSYSTEMS]
|
||||
temporary = D[TEMPORARY]
|
||||
threads = D[THREADS]
|
Loading…
Add table
Add a link
Reference in a new issue