747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
|
# File 'lib/na/next_action.rb', line 747
def save_search(title, search)
file = database_path(file: 'saved_searches.yml')
searches = load_searches
title = title.gsub(/[^a-z0-9]/, '_').gsub(/_+/, '_')
if searches.key?(title)
res = yn('Overwrite existing definition?', default: true)
notify('{r}Cancelled', exit_code: 0) unless res
end
searches[title] = search
File.open(file, 'w') { |f| f.puts(YAML.dump(searches)) }
NA.notify("{y}Search #{title} saved", exit_code: 0)
end
|