Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add back deprecated command-line args as aliases of new ones #167

Merged
merged 2 commits into from
Apr 26, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions cmd/jsonnet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ void usage(std::ostream &o)
o << "Available options for specifying values of 'external' variables:\n";
o << "Provide the value as a string:\n";
o << " -V / --ext-str <var>[=<val>] If <val> is omitted, get from environment var <var>\n";
o << " -f / --ext-str-file <var>=<file> Read the string from the file\n";
o << " --ext-str-file <var>=<file> Read the string from the file\n";
o << "Provide a value as Jsonnet code:\n";
o << " --ext-code <var>[=<code>] If <code> is omitted, get from environment var <var>\n";
o << " --ext-code-file <var>=<file> Read the code from the file\n";
o << "\n";
o << "Available options for specifying values of 'top-level arguments':\n";
o << "Provide the value as a string:\n";
o << " -V / --tla-str <var>[=<val>] If <val> is omitted, get from environment var <var>\n";
o << " -f / --tla-str-file <var>=<file> Read the string from the file\n";
o << " -A / --tla-str <var>[=<val>] If <val> is omitted, get from environment var <var>\n";
o << " --tla-str-file <var>=<file> Read the string from the file\n";
o << "Provide a value as Jsonnet code:\n";
o << " --tla-code <var>[=<code>] If <code> is omitted, get from environment var <var>\n";
o << " --tla-code-file <var>=<file> Read the code from the file\n";
Expand Down Expand Up @@ -270,27 +270,32 @@ static bool process_args(int argc,
dir += '/';
}
jsonnet_jpath_add(vm, dir.c_str());
} else if (arg == "-V" || arg == "--ext-str") {
// TODO(dcunnin): Remove deprecated --var, --env and -E
} else if (arg == "-V" || arg == "--ext-str"
|| arg == "--var" || arg == "--env" || arg == "-E") {
std::string var, val;
if (!get_var_val(next_arg(i, args), var, val))
return EXIT_FAILURE;
jsonnet_ext_var(vm, var.c_str(), val.c_str());
} else if (arg == "-F" || arg == "--ext-str-file") {
// TODO(dcunnin): Remove deprecated --file and -F
} else if (arg == "--ext-str-file" || arg == "--file" || arg == "-F") {
std::string var, val;
if (!get_var_file(next_arg(i, args), var, val))
return EXIT_FAILURE;
jsonnet_ext_var(vm, var.c_str(), val.c_str());
} else if (arg == "--ext-code") {
// TODO(dcunnin): Remove deprecated --code-var, --code-env
} else if (arg == "--ext-code" || arg == "--code-var" || arg == "--code-env") {
std::string var, val;
if (!get_var_val(next_arg(i, args), var, val))
return EXIT_FAILURE;
jsonnet_ext_code(vm, var.c_str(), val.c_str());
} else if (arg == "--ext-code-file") {
// TODO(dcunnin): Remove deprecated --code-file
} else if (arg == "--ext-code-file" || arg == "--code-file") {
std::string var, val;
if (!get_var_file(next_arg(i, args), var, val))
return EXIT_FAILURE;
jsonnet_ext_code(vm, var.c_str(), val.c_str());
} else if (arg == "--tla-str") {
} else if (arg == "-A" || arg == "--tla-str") {
std::string var, val;
if (!get_var_val(next_arg(i, args), var, val))
return EXIT_FAILURE;
Expand Down