Skip to content

Instantly share code, notes, and snippets.

@kblomqvist
Last active December 15, 2015 10:29
Show Gist options
  • Save kblomqvist/5246221 to your computer and use it in GitHub Desktop.
Save kblomqvist/5246221 to your computer and use it in GitHub Desktop.
Brainstorming the look of docopt.c struct
typedef struct {
/* flag options */
int h;
int help;
int moored;
int version;
/* options with arguments */
char *speed;
/* positional arguments */
char *name;
char *x;
char *y;
/* commands */
int ship;
int mine;
/* subcommands */
int move;
int new;
int remove;
int set;
int shoot;
/* special */
char *usage;
char *help;
int error;
} DocoptArgs;
typedef struct {
/* flag options */
int _h;
int __help;
int __moored;
int __version;
/* options with arguments */
char *__speed;
/* positional arguments */
char *NAME;
char *X;
char *Y;
/* commands */
int ship;
int mine;
/* subcommands */
int move;
int new;
int remove;
int set;
int shoot;
/* special */
char *usage;
char *help;
int error;
} DocoptArgs;
{"--drifting": false,
"--help": false,
"--moored": false,
"--speed": "20",
"--version": false,
"<name>": ["Guardian"],
"<x>": "10",
"<y>": "50",
"mine": false,
"move": true,
"new": false,
"remove": false,
"set": false,
"ship": true,
"shoot": false}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment