Skip to content

allow multiple files for command line tool#884

Merged
kivikakk merged 2 commits intogithub:masterfrom
oklas:cli-multi-files
Mar 19, 2017
Merged

allow multiple files for command line tool#884
kivikakk merged 2 commits intogithub:masterfrom
oklas:cli-multi-files

Conversation

@oklas
Copy link
Copy Markdown
Contributor

@oklas oklas commented Apr 1, 2016

useful for prepare for printing multiple documents:
github-markup repo/docs/*
instead of
echo repo/docs/* | xargs github-markup

useful for prepare for printing multiple documents:
github-markup repo/docs/*
instead of
echo repo/docs/* | xargs github-markup
file = File.open( s, "r" )
sources.push [ s, file ]
rescue Exception => e
print "error: #{e.message}\n"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be acceptable to print this to STDERR then exit with an error code. Currently this will go straight to STDOUT with the result of the output of the command.

}

sources.each { |s|
name,file = s
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider this form instead:

sources.each { |name, file|

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kivikakk, advices are implemented, thanks

puts "usage: #$0 FILE"
if ARGV.size < 1
print "usage: #$0 FILE [ FILES ... ]\n"
exit
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe exit 1?

@kivikakk
Copy link
Copy Markdown
Contributor

Thank you! ✨

@kivikakk kivikakk merged commit cc3ff6d into github:master Mar 19, 2017
Copy link
Copy Markdown

@heryfajir12 heryfajir12 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants