-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for multiple files - input as a file list - using -f flag #21
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,6 +132,11 @@ def parse_arg(): | |
type=str, | ||
default="default", | ||
metavar="NAME") | ||
parser.add_argument( | ||
"-f", | ||
"--filelist", | ||
help="filename contains list of files to be converted", | ||
action="store_true") | ||
parser.add_argument( | ||
"-v", | ||
"--version", | ||
|
@@ -142,9 +147,19 @@ def parse_arg(): | |
|
||
def main(): | ||
args = parse_arg() | ||
pdf_file = get_output_file(args.filename, args.outputfile) | ||
pdf = Code2pdf(args.filename, pdf_file, args.size) | ||
pdf.init_print(linenos=args.linenos, style=args.style) | ||
if (args.filelist == False): | ||
pdf_file = get_output_file(args.filename, args.outputfile) | ||
pdf = Code2pdf(args.filename, pdf_file, args.size) | ||
pdf.init_print(linenos=args.linenos, style=args.style) | ||
else: | ||
with open(args.filename) as filelist: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cibinjoseph I doubt here Anyway, that's why I asked for a test suite. :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems to work for me. And yes, I did want to finish the test suite but got caught up with some work. Don't accept without the test suite! :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I remember getting a segmentation fault from PyQT after the program run (for the copy in your repo too). That seemed to deter me from working on the test suite. Have to check if it still exists when PyQT is compiled from scratch. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @cibinjoseph Cool! I misunderstood Please feel free to look into the seg fault issue as I've not been able to investigate myself due to work commitments. I believe there is already an issue created by you for this. |
||
filenames=filelist.read().splitlines() | ||
for ifile in filenames: | ||
args.filename=ifile | ||
pdf_file = get_output_file(args.filename, args.outputfile) | ||
pdf = Code2pdf(args.filename, pdf_file, args.size) | ||
pdf.init_print(linenos=args.linenos, style=args.style) | ||
|
||
return 0 | ||
|
||
if __name__ == "__main__": | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cibinjoseph Hi! Can we add a test suite for your changes before we merge? Also, update the usage/argparser instructions accordingly. Thanks! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(On the test suite) Sure! How do you wanna go about it?
And I had already updated the argparser instructions in the commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll edit the 'usage' section in a while!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cibinjoseph You may find some test suit written under
tests/test.py
. You may add yours there as well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, got it!