if __name__ == '__main__':
global_command = argparse.ArgumentParser()
subparser = global_command.add_subparsers(
dest='subparser_name', help='...')
#we add parser for the partionner and the arguments
partionner_command = subparser.add_parser('partitioned_edf', help ='adding parser')
partionner_command.add_argument('file', help='input file', type=argparse.FileType('r'))
partionner_command.add_argument('h', help='heuristic')
partionner_command.add_argument('ff|wf|bf|nf', help='first fit')
partionner_command.add_argument('s', help='sort')
partionner_command.add_argument('du|iu', help='decreasing utilization')
partionner_command.add_argument('l', help='limits')
partionner_command.add_argument('limit', type= int, help='positive integer,the time step limit for simulation')
partionner_command.add_argument('m', help='the number of identical cores')
partionner_command.add_argument('cores', type= int, help='positive integer, the number of identical cores')
#namespace takes the arguments
namespace = global_command.parse_args()
if namespace.subparser_name is None:
from sys import stderr
global_command.print_help(stderr)
elif namespace.subparser_name == 'partitioned_edf':
After that elif I want to make cases depending on the third argument:
(if we have ff, wf, bf or nf in the console).
- Edité par PassantPassant1 18 novembre 2020 à 10:22:29
How can I manipulate parser arguments?
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.