diff --git a/bucket-tool b/bucket-tool index 971daaf..7be1cc8 100755 --- a/bucket-tool +++ b/bucket-tool @@ -568,6 +568,10 @@ def get_entry_by_file (bucket, filenames) end end + if $CONFIG[:alt_filepath] != "" + return entry, $CONFIG[:alt_filepath] + end + if filename[0] != '/' filename = "/#{filename}" end @@ -578,6 +582,12 @@ end def get_entry_by_hash (bucket) if bucket.entries.has_key? $CONFIG[:search_term] entry = bucket.entries[$CONFIG[:search_term]] + + if $CONFIG[:alt_filepath] != "" + log "$CONFIG[:alt_filepath] was set. Skipping prompts asking for filepaths" + return entry, $CONFIG[:alt_filepath] + end + filepath = "" if entry.filepaths.count == 1 filepath = entry.filepaths[0] @@ -605,10 +615,6 @@ def restore_entry (bucket) entry, filepath = get_entry_by_hash bucket end - if $CONFIG[:alt_filepath] != "" - filepath=$CONFIG[:alt_filepath] - end - if get_verification "Are you sure you want to overwrite #{filepath}?" File.open(filepath,'w') do |file| file.write(entry.content)