Merge branch 'master' into ubuntu

This commit is contained in:
Petr Bena 2014-05-25 19:13:15 +02:00
commit cec0cbd749
6 changed files with 19 additions and 10 deletions

View File

@ -49,3 +49,10 @@ echo "Hello world" | stikkit
url is an url to stikked server for example, if your server is http://something.blah/stikked and your api is http://something.blah/stikked/api then use http://something.blah/stikked as parameter to -b url is an url to stikked server for example, if your server is http://something.blah/stikked and your api is http://something.blah/stikked/api then use http://something.blah/stikked as parameter to -b
The url parameter can be stored to configuration file (stikkit will ask you in case there is none in config file) The url parameter can be stored to configuration file (stikkit will ask you in case there is none in config file)
Tips
=====
Do you have a server and want to setup default pastebin site for all users in system?
Create /etc/stikkit/url which contains the url of default pastebin site. Users will be able to override it, but by default everyone on system will use this

View File

@ -24,9 +24,10 @@ string Configuration::URL = "";
string Configuration::Expiry = "60"; string Configuration::Expiry = "60";
bool Configuration::Private = false; bool Configuration::Private = false;
string Configuration::Author = ""; string Configuration::Author = "";
string Configuration::Version = "1.0.4"; string Configuration::Version = "1.0.5";
string Configuration::Title = ""; string Configuration::Title = "";
string Configuration::Home = ""; string Configuration::Home = "";
bool Configuration::NoExtras = false;
string Configuration::Input = ""; string Configuration::Input = "";
string Configuration::DefaultURL = ""; string Configuration::DefaultURL = "";

View File

@ -33,6 +33,7 @@ namespace Stikkit
static string DefaultURL; static string DefaultURL;
static bool Private; static bool Private;
static string Home; static string Home;
static bool NoExtras;
}; };
} }

View File

@ -129,7 +129,10 @@ int main(int argc, char *argv[])
cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << endl; cerr << "curl_easy_perform() failed: " << curl_easy_strerror(res) << endl;
return 12; return 12;
} }
if (!Stikkit::Configuration::NoExtras)
cout << "Successfully pastebined to: " << readBuffer; cout << "Successfully pastebined to: " << readBuffer;
else
cout << readBuffer;
curl_easy_cleanup(curl); curl_easy_cleanup(curl);
} else } else
{ {

View File

@ -106,11 +106,8 @@ bool TerminalParser::Parse()
return true; return true;
} }
if (!valid) if (!valid)
{
if (!this->Silent)
{ {
cerr << "This parameter isn't valid: " << text << endl; cerr << "This parameter isn't valid: " << text << endl;
}
return true; return true;
} }
x++; x++;
@ -131,15 +128,15 @@ bool TerminalParser::ParseChar(char x)
case 'p': case 'p':
Configuration::Private = true; Configuration::Private = true;
return false; return false;
case 's':
Configuration::NoExtras = true;
return false;
} }
return false; return false;
} }
void TerminalParser::DisplayHelp() void TerminalParser::DisplayHelp()
{ {
if (this->Silent)
return;
cout << "Stikkit - open source pastebin uploader for Stikked\n\n"\ cout << "Stikkit - open source pastebin uploader for Stikked\n\n"\
"Parameters:\n"\ "Parameters:\n"\
" -a <name>: Specify author name by default the current\n"\ " -a <name>: Specify author name by default the current\n"\
@ -149,6 +146,7 @@ void TerminalParser::DisplayHelp()
" -v: Increases verbosity\n"\ " -v: Increases verbosity\n"\
" -t <title>: Set a title for a paste\n"\ " -t <title>: Set a title for a paste\n"\
" -p: Mark a paste as private (not visible in recent pastes)\n"\ " -p: Mark a paste as private (not visible in recent pastes)\n"\
" -s: Display only RAW url of paste and no extra text\n"\
" -e <minutes>: Set expiry in minutes, parameter needs to be a number\n"\ " -e <minutes>: Set expiry in minutes, parameter needs to be a number\n"\
" --version: Display a version\n"\ " --version: Display a version\n"\
" -h | --help: Display this help\n\n"\ " -h | --help: Display this help\n\n"\

View File

@ -23,7 +23,6 @@ namespace Stikkit
bool Parse(); bool Parse();
bool ParseChar(char x); bool ParseChar(char x);
void DisplayHelp(); void DisplayHelp();
bool Silent;
private: private:
int argc; int argc;
char **argv; char **argv;