mirror of https://github.com/aria2/aria2
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added --no-conf and --conf-path command-line option. --no-conf option disables loading aria2.conf file. --conf-path option changes the configuration file path. The default file path is $HOME/.aria2/aria2.conf Added a warning message when the configuration file is not found. * src/HelpItemFactory.cc * src/option_processing.cc * src/prefs.h * src/usage_text.hpull/1/head
parent
08a8d8aae2
commit
eafabe2d44
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
||||||
|
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
|
Added --no-conf and --conf-path command-line option.
|
||||||
|
--no-conf option disables loading aria2.conf file.
|
||||||
|
--conf-path option changes the configuration file path. The default
|
||||||
|
file path is $HOME/.aria2/aria2.conf
|
||||||
|
Added a warning message when the configuration file is not found.
|
||||||
|
* src/HelpItemFactory.cc
|
||||||
|
* src/option_processing.cc
|
||||||
|
* src/prefs.h
|
||||||
|
* src/usage_text.h
|
||||||
|
|
||||||
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
2008-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||||
|
|
||||||
Added the message to inform users that other help categories are
|
Added the message to inform users that other help categories are
|
||||||
|
|
|
@ -388,6 +388,16 @@ TagContainerHandle HelpItemFactory::createHelpItems()
|
||||||
item->addTag(TAG_BASIC);
|
item->addTag(TAG_BASIC);
|
||||||
tc->addItem(item);
|
tc->addItem(item);
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
HelpItemHandle item = new HelpItem("no-conf", TEXT_NO_CONF);
|
||||||
|
item->addTag(TAG_ADVANCED);
|
||||||
|
tc->addItem(item);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
HelpItemHandle item = new HelpItem("conf-path", TEXT_CONF_PATH, "$HOME/.aria2/aria2.conf");
|
||||||
|
item->addTag(TAG_ADVANCED);
|
||||||
|
tc->addItem(item);
|
||||||
|
}
|
||||||
{
|
{
|
||||||
HelpItemHandle item = new HelpItem("help", TEXT_HELP, TAG_BASIC);
|
HelpItemHandle item = new HelpItem("help", TEXT_HELP, TAG_BASIC);
|
||||||
char buf[64];
|
char buf[64];
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "Exception.h"
|
#include "Exception.h"
|
||||||
#include "a2io.h"
|
#include "a2io.h"
|
||||||
#include "help_tags.h"
|
#include "help_tags.h"
|
||||||
|
#include "LogFactory.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
@ -132,6 +133,11 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
op->put(PREF_METALINK_PREFERRED_PROTOCOL, V_NONE);
|
op->put(PREF_METALINK_PREFERRED_PROTOCOL, V_NONE);
|
||||||
op->put(PREF_ENABLE_PEER_EXCHANGE, V_TRUE);
|
op->put(PREF_ENABLE_PEER_EXCHANGE, V_TRUE);
|
||||||
op->put(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL, V_TRUE);
|
op->put(PREF_METALINK_ENABLE_UNIQUE_PROTOCOL, V_TRUE);
|
||||||
|
|
||||||
|
// following options are not parsed by OptionHandler and not stored in Option.
|
||||||
|
bool noConf = false;
|
||||||
|
string cfname = Util::getHomeDir()+"/.aria2/aria2.conf";
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
int optIndex = 0;
|
int optIndex = 0;
|
||||||
int lopt;
|
int lopt;
|
||||||
|
@ -184,6 +190,8 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
{ PREF_ENABLE_DIRECT_IO, optional_argument, &lopt, 210 },
|
{ PREF_ENABLE_DIRECT_IO, optional_argument, &lopt, 210 },
|
||||||
#endif // ENABLE_DIRECT_IO
|
#endif // ENABLE_DIRECT_IO
|
||||||
{ PREF_ALLOW_PIECE_LENGTH_CHANGE, required_argument, &lopt, 211 },
|
{ PREF_ALLOW_PIECE_LENGTH_CHANGE, required_argument, &lopt, 211 },
|
||||||
|
{ PREF_NO_CONF, no_argument, &lopt, 212 },
|
||||||
|
{ PREF_CONF_PATH, required_argument, &lopt, 213 },
|
||||||
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
#if defined ENABLE_BITTORRENT || ENABLE_METALINK
|
||||||
{ "show-files", no_argument, NULL, 'S' },
|
{ "show-files", no_argument, NULL, 'S' },
|
||||||
{ "select-file", required_argument, &lopt, 21 },
|
{ "select-file", required_argument, &lopt, 21 },
|
||||||
|
@ -353,6 +361,12 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
case 211:
|
case 211:
|
||||||
cmdstream << PREF_ALLOW_PIECE_LENGTH_CHANGE << "=" << optarg << "\n";
|
cmdstream << PREF_ALLOW_PIECE_LENGTH_CHANGE << "=" << optarg << "\n";
|
||||||
break;
|
break;
|
||||||
|
case 212:
|
||||||
|
noConf = true;
|
||||||
|
break;
|
||||||
|
case 213:
|
||||||
|
cfname = optarg;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -440,7 +454,8 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
{
|
{
|
||||||
OptionParser oparser;
|
OptionParser oparser;
|
||||||
oparser.setOptionHandlers(OptionHandlerFactory::createOptionHandlers());
|
oparser.setOptionHandlers(OptionHandlerFactory::createOptionHandlers());
|
||||||
string cfname = Util::getHomeDir()+"/.aria2/aria2.conf";
|
if(!noConf) {
|
||||||
|
if(File(cfname).isFile()) {
|
||||||
ifstream cfstream(cfname.c_str());
|
ifstream cfstream(cfname.c_str());
|
||||||
try {
|
try {
|
||||||
oparser.parse(op, cfstream);
|
oparser.parse(op, cfstream);
|
||||||
|
@ -450,6 +465,10 @@ Option* option_processing(int argc, char* const argv[])
|
||||||
delete e;
|
delete e;
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
LogFactory::getInstance()->warn("Configuration file %s is not found.", cfname.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
oparser.parse(op, cmdstream);
|
oparser.parse(op, cmdstream);
|
||||||
} catch(Exception* e) {
|
} catch(Exception* e) {
|
||||||
|
|
|
@ -120,6 +120,10 @@
|
||||||
#define PREF_ENABLE_DIRECT_IO "enable-direct-io"
|
#define PREF_ENABLE_DIRECT_IO "enable-direct-io"
|
||||||
// value: true | false
|
// value: true | false
|
||||||
#define PREF_ALLOW_PIECE_LENGTH_CHANGE "allow-piece-length-change"
|
#define PREF_ALLOW_PIECE_LENGTH_CHANGE "allow-piece-length-change"
|
||||||
|
// value: true | false
|
||||||
|
#define PREF_NO_CONF "no-conf"
|
||||||
|
// value: string
|
||||||
|
#define PREF_CONF_PATH "conf-path"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FTP related preferences
|
* FTP related preferences
|
||||||
|
|
|
@ -302,3 +302,7 @@ _(" -h, --help[=CATEGORY] Print usage and exit.\n"\
|
||||||
" http. If no matching category is found, search\n"\
|
" http. If no matching category is found, search\n"\
|
||||||
" option name in forward match and print the\n"\
|
" option name in forward match and print the\n"\
|
||||||
" result.")
|
" result.")
|
||||||
|
#define TEXT_NO_CONF \
|
||||||
|
_(" --no-conf Disable loading aria2.conf file.")
|
||||||
|
#define TEXT_CONF_PATH \
|
||||||
|
_(" --conf-path=PATH Change the configuration file path to PATH.")
|
||||||
|
|
Loading…
Reference in New Issue