esvsearch: extract query into variable
This commit is contained in:
parent
663cb91cd3
commit
140376887a
1 changed files with 4 additions and 1 deletions
|
@ -44,6 +44,7 @@ main(string[] args)
|
||||||
ESVApi esv;
|
ESVApi esv;
|
||||||
string apiKey;
|
string apiKey;
|
||||||
string configPath;
|
string configPath;
|
||||||
|
string query;
|
||||||
|
|
||||||
sharedInit(args);
|
sharedInit(args);
|
||||||
|
|
||||||
|
@ -73,6 +74,8 @@ main(string[] args)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
query = args[1].dup();
|
||||||
|
|
||||||
/* determine configuration file: options take first priority,
|
/* determine configuration file: options take first priority,
|
||||||
* then environment variables, and then the default path */
|
* then environment variables, and then the default path */
|
||||||
configPath = environment.get(cf.configEnv, cf.configPath)
|
configPath = environment.get(cf.configEnv, cf.configPath)
|
||||||
|
@ -100,7 +103,7 @@ main(string[] args)
|
||||||
esv = ESVApi(apiKey);
|
esv = ESVApi(apiKey);
|
||||||
|
|
||||||
try
|
try
|
||||||
writeln(esv.searchFormat(args[1]));
|
writeln(esv.searchFormat(query));
|
||||||
catch (ESVException)
|
catch (ESVException)
|
||||||
die("no results");
|
die("no results");
|
||||||
catch (CurlException e)
|
catch (CurlException e)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue