Skip to content

Commit

Permalink
Add "--update" option to overwrite the soruce
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jun 27, 2014
1 parent 9b71656 commit 50f5695
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bin/droonga-engine-modify-catalog
Expand Up @@ -34,6 +34,7 @@ datasets = {
options = OpenStruct.new
options.source_path = "./catalog.json"
options.output_path = "-"
options.update = false
parser = OptionParser.new
parser.version = Droonga::Engine::VERSION
parser.on("--source=PATH",
Expand All @@ -48,6 +49,11 @@ parser.on("--output=PATH",
"(#{options.output_path})") do |path|
options.output_path = path
end
parser.on("--[no-]update",
"Update the source file itself, or not.",
"(#{options.update})") do |update|
options.update = update
end
parser.on("--dataset=NAME",
"Add a dataset its name is NAME.",
"And set the NAME to the current dataset.") do |name|
Expand All @@ -63,6 +69,9 @@ parser.on("--remove-replica-hosts=NAME1,NAME2,...", Array,
end
parser.parse!(ARGV)

if options.source_path != "-" and options.update
options.output_path = options.source_path
end

def load_source(path)
source = nil
Expand Down

0 comments on commit 50f5695

Please sign in to comment.