Add halp
This commit is contained in:
parent
6ee7adb6a4
commit
d84c9ad364
22
fedi_post.c
22
fedi_post.c
|
@ -37,6 +37,16 @@ static Sdb *load_sdb (char *path) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void halp () {
|
||||
puts ( "fedi_post [postfile] [-i] [-a <number of attachements>"
|
||||
" <attachment 1> <attachment 2>...<attachment N>\n\n"
|
||||
"postfile contains your post. alternativly you can use -i flag.\n"
|
||||
"if you use -i flag fedi_post opens $EDITOR.\n"
|
||||
"then you write your post, save, quit and fedi_post will do your post\n\n"
|
||||
"you can also attach files to your posts with the -a flag.\n"
|
||||
"if you use -a you need to provide the amount of files you want to attach to your post\n");
|
||||
}
|
||||
|
||||
static FediPostCFG *get_cfg (int argc, char *argv[]) {
|
||||
FediPostCFG *fpcfg;
|
||||
if (!argc || !(fpcfg = R_NEW0 (FediPostCFG))) {
|
||||
|
@ -60,7 +70,6 @@ static FediPostCFG *get_cfg (int argc, char *argv[]) {
|
|||
eprintf ("'instance' is not set in %s :(\n", config_path);
|
||||
fail = true;
|
||||
}
|
||||
puts (sdb_const_get (db, "instance", 0));
|
||||
if (!sdb_exists (db, "user")) {
|
||||
eprintf ("'user' is not set in %s :(\n", config_path);
|
||||
fail = true;
|
||||
|
@ -117,8 +126,19 @@ static FediPostCFG *get_cfg (int argc, char *argv[]) {
|
|||
!r_file_is_directory (argv[i])) {
|
||||
fpcfg->post = argv[i];
|
||||
}
|
||||
if (!strcmp (argv[i], "--help")) {
|
||||
puts ("Who would type --help, if -h exists?");
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
if (!strcmp (argv[i], "-h")) {
|
||||
halp ();
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (fail) {
|
||||
free (fpcfg->attachments);
|
||||
free (fpcfg->instance);
|
||||
free (fpcfg->creds);
|
||||
free (fpcfg);
|
||||
|
|
Loading…
Reference in New Issue
Block a user