diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-10-02 16:39:54 +0100 |
---|---|---|
committer | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2014-10-02 16:39:54 +0100 |
commit | 4754ef751279d6c844c098c0499d6d41fdf2283d (patch) | |
tree | 358d6ae894805fc67de3196ec5f10ea3e6525a62 | |
parent | 9d5f171347b20d443436d0b2bf765a533969e6a2 (diff) | |
download | morph-4754ef751279d6c844c098c0499d6d41fdf2283d.tar.gz |
import: Exit with a clearer error when wrong args are passed
The help output goes on stdout and so it is lost if being run from
main.py. We need to have something on stderr to make sure that it gets
seen by the user, otherwise there's no clue why the extension subprocess
failed.
-rw-r--r-- | import/importer_base.rb | 2 | ||||
-rwxr-xr-x | import/omnibus.to_lorry | 3 | ||||
-rwxr-xr-x | import/rubygems.to_chunk | 3 |
3 files changed, 5 insertions, 3 deletions
diff --git a/import/importer_base.rb b/import/importer_base.rb index 820d53c1..4f3d2f51 100644 --- a/import/importer_base.rb +++ b/import/importer_base.rb @@ -34,7 +34,7 @@ module Importer opts.on('-?', '--help', 'print this help') do puts opts print "\n", description - exit 1 + exit 255 end end diff --git a/import/omnibus.to_lorry b/import/omnibus.to_lorry index df579b9f..ed2e552d 100755 --- a/import/omnibus.to_lorry +++ b/import/omnibus.to_lorry @@ -44,8 +44,9 @@ class OmnibusLorryGenerator < Importer::Base parsed_arguments = opts.parse!(arguments) if parsed_arguments.length != 2 + STDERR.puts "Expected 2 arguments, got #{parsed_arguments}." opts.parse(['-?']) - exit 1 + exit 255 end definitions_and_project, software_name = parsed_arguments diff --git a/import/rubygems.to_chunk b/import/rubygems.to_chunk index c90cda23..0a939a0f 100755 --- a/import/rubygems.to_chunk +++ b/import/rubygems.to_chunk @@ -56,8 +56,9 @@ class RubyGemChunkMorphologyGenerator < Importer::Base parsed_arguments = opts.parse!(arguments) if parsed_arguments.length != 2 && parsed_arguments.length != 3 + STDERR.puts "Expected 2 or 3 arguments, got #{parsed_arguments}." opts.parse(['-?']) - exit 1 + exit 255 end source_dir, gem_name, expected_version = parsed_arguments |