Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add for a getter for aws_cli_optarg #1179

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/aws/common/command_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ AWS_COMMON_API int aws_cli_getopt_long(
*/
AWS_COMMON_API void aws_cli_reset_state(void);

/*
* Returns the aws_cli_optarg variable
*/
AWS_COMMON_API const char *aws_get_cli_optarg(void);

/**
* Dispatches the current command line arguments with a subcommand from the second input argument in argv[], if
* dispatch table contains a command that matches the argument. When the command is dispatched, argc and argv will be
Expand Down
4 changes: 4 additions & 0 deletions source/command_line_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ bool aws_cli_on_arg = false;
const char *aws_cli_optarg = NULL;
const char *aws_cli_positional_arg = NULL;

const char *aws_get_cli_optarg(void) {
return aws_cli_optarg;
}

static const struct aws_cli_option *s_find_option_from_char(
const struct aws_cli_option *longopts,
char search_for,
Expand Down