diff --git a/exe/yamlfish b/exe/yamlfish index 02707e7..bc01ca9 100755 --- a/exe/yamlfish +++ b/exe/yamlfish @@ -9,6 +9,9 @@ class YamlfishExe < Thor option :branch, type: :string, default: "main" def push(locale) Yamlfish::Cli::Push.new(locale, branch: options[:branch]).call + rescue Errno::ENOENT => e + puts Rainbow("Could not push: #{e.message}").red.bright + exit 1 end desc "pull", "Pulls translations from yamlfish" @@ -17,6 +20,9 @@ class YamlfishExe < Thor option :branch, type: :string, default: "main" def pull(locale) Yamlfish::Cli::Pull.new(locale, inplace: options[:inplace], force_update: options[:force_update], branch: options[:branch]).call + rescue Errno::ENOENT => e + puts Rainbow("Could not pull: #{e.message}").red.bright + exit 1 end desc "version", "Prints the version" diff --git a/lib/yamlfish/cli/pull.rb b/lib/yamlfish/cli/pull.rb index f373031..cbe112f 100644 --- a/lib/yamlfish/cli/pull.rb +++ b/lib/yamlfish/cli/pull.rb @@ -28,7 +28,7 @@ def call if response.status != 200 puts Rainbow("Failed to pull, unexpected HTTP status #{response.status}").red.bright - return + exit 1 end translations = JSON.parse(response.body) diff --git a/lib/yamlfish/cli/push.rb b/lib/yamlfish/cli/push.rb index e96ff2e..3e15885 100644 --- a/lib/yamlfish/cli/push.rb +++ b/lib/yamlfish/cli/push.rb @@ -31,6 +31,7 @@ def call puts "Successfully pushed translations for locale #{Rainbow(@locale_identifier).magenta.bright} on branch #{Rainbow(@branch).magenta.bright}" else puts Rainbow("Failed to push, unexpected HTTP status #{response.status}").red.bright + exit 1 end end end