@@ -2845,7 +2845,7 @@ def __init__(self, value):
28452845 description = 'disassemble one or more pickle files' )
28462846 parser .add_argument (
28472847 'pickle_file' ,
2848- nargs = '* ' , help = 'the pickle file' )
2848+ nargs = '+ ' , help = 'the pickle file' )
28492849 parser .add_argument (
28502850 '-o' , '--output' ,
28512851 help = 'the file where the output should be written' )
@@ -2863,26 +2863,23 @@ def __init__(self, value):
28632863 help = 'if more than one pickle file is specified, print this before'
28642864 ' each disassembly' )
28652865 args = parser .parse_args ()
2866- if not args .pickle_file :
2867- parser .print_help ()
2866+ annotate = 30 if args .annotate else 0
2867+ memo = {} if args .memo else None
2868+ if args .output is None :
2869+ output = sys .stdout
28682870 else :
2869- annotate = 30 if args .annotate else 0
2870- memo = {} if args .memo else None
2871- if args .output is None :
2872- output = sys .stdout
2873- else :
2874- output = open (args .output , 'w' )
2875- try :
2876- for arg in args .pickle_file :
2877- if len (args .pickle_file ) > 1 :
2878- name = '<stdin>' if arg == '-' else arg
2879- preamble = args .preamble .format (name = name )
2880- output .write (preamble + '\n ' )
2881- if arg == '-' :
2882- dis (sys .stdin .buffer , output , memo , args .indentlevel , annotate )
2883- else :
2884- with open (arg , 'rb' ) as f :
2885- dis (f , output , memo , args .indentlevel , annotate )
2886- finally :
2887- if output is not sys .stdout :
2888- output .close ()
2871+ output = open (args .output , 'w' )
2872+ try :
2873+ for arg in args .pickle_file :
2874+ if len (args .pickle_file ) > 1 :
2875+ name = '<stdin>' if arg == '-' else arg
2876+ preamble = args .preamble .format (name = name )
2877+ output .write (preamble + '\n ' )
2878+ if arg == '-' :
2879+ dis (sys .stdin .buffer , output , memo , args .indentlevel , annotate )
2880+ else :
2881+ with open (arg , 'rb' ) as f :
2882+ dis (f , output , memo , args .indentlevel , annotate )
2883+ finally :
2884+ if output is not sys .stdout :
2885+ output .close ()
0 commit comments