Skip to content

Commit

Permalink
Fix usage instruction and error handling (#2)
Browse files Browse the repository at this point in the history
* Minor change to instruction
* Gracefully require patterns file argument
  • Loading branch information
briandominick authored Jun 7, 2018
1 parent 4aa2d9f commit 4cefbc9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions lib/subtxt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ def load_patterns pfile
end

def subtexts opts
unless opts[:patterns]
@logger.error "Missing patterns file!"
exit
end
patterns = load_patterns(opts[:patterns])
@logger.info "Reading patterns from #{@options[:patterns]}"
@logger.info "Reading patterns from #{opts[:patterns]}"
routine = {}
routine['files_count'] = 0
routine['files_changed'] = []
Expand Down Expand Up @@ -130,12 +134,12 @@ def display_results routine={}
(#{@expath_def}/ by default) after replacing each matched pattern with
its pair.
Usage: subtxt [path/to/ingest/dir] [options]
Usage: subtxt [path/to/patterns.ext] [options]
Options:
"""

unless ARGV[0]
@logger.error "You must at least provide a patterns file option. For help, use\nsubtxt --help"
@logger.error "You must at least provide a patterns file argument. For help, use\nsubtxt --help"
exit
end

Expand Down
2 changes: 1 addition & 1 deletion lib/subtxt/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Subtxt
VERSION = "0.2.0"
VERSION = "0.2.1"
end

0 comments on commit 4cefbc9

Please sign in to comment.