Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
90d3cc6c
Commit
90d3cc6c
authored
Jul 24, 2023
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: common options
parent
005bccea
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
24 deletions
+25
-24
src/cli/cmd_cat_file.c
+1
-3
src/cli/cmd_clone.c
+1
-3
src/cli/cmd_config.c
+1
-13
src/cli/cmd_hash_object.c
+1
-3
src/cli/cmd_help.c
+2
-2
src/cli/common.h
+19
-0
No files found.
src/cli/cmd_cat_file.c
View file @
90d3cc6c
...
...
@@ -24,9 +24,7 @@ static int display = DISPLAY_CONTENT;
static
char
*
type_name
,
*
object_spec
;
static
const
cli_opt_spec
opts
[]
=
{
{
CLI_OPT_TYPE_SWITCH
,
"help"
,
0
,
&
show_help
,
1
,
CLI_OPT_USAGE_HIDDEN
|
CLI_OPT_USAGE_STOP_PARSING
,
NULL
,
"display help about the "
COMMAND_NAME
" command"
},
CLI_COMMON_OPT
,
{
CLI_OPT_TYPE_SWITCH
,
NULL
,
't'
,
&
display
,
DISPLAY_TYPE
,
CLI_OPT_USAGE_REQUIRED
,
NULL
,
"display the type of the object"
},
...
...
src/cli/cmd_clone.c
View file @
90d3cc6c
...
...
@@ -24,9 +24,7 @@ static bool local_path_exists;
static
cli_progress
progress
=
CLI_PROGRESS_INIT
;
static
const
cli_opt_spec
opts
[]
=
{
{
CLI_OPT_TYPE_SWITCH
,
"help"
,
0
,
&
show_help
,
1
,
CLI_OPT_USAGE_HIDDEN
|
CLI_OPT_USAGE_STOP_PARSING
,
NULL
,
"display help about the "
COMMAND_NAME
" command"
},
CLI_COMMON_OPT
,
{
CLI_OPT_TYPE_SWITCH
,
"quiet"
,
'q'
,
&
quiet
,
1
,
CLI_OPT_USAGE_DEFAULT
,
NULL
,
"display the type of the object"
},
...
...
src/cli/cmd_config.c
View file @
90d3cc6c
...
...
@@ -25,20 +25,8 @@ static int show_help;
static
int
null_separator
;
static
char
*
name
;
#define CLI_COMMON_OPT_HELP \
CLI_OPT_TYPE_SWITCH, "help", 0, &show_help, 1, \
CLI_OPT_USAGE_HIDDEN | CLI_OPT_USAGE_STOP_PARSING
#define CLI_COMMON_OPT_CONFIG \
CLI_OPT_TYPE_VALUE, NULL, 'c', NULL, 0, \
CLI_OPT_USAGE_HIDDEN
#define CLI_COMMON_OPT_CONFIG_ENV \
CLI_OPT_TYPE_VALUE, "config-env", 0, NULL, 0, \
CLI_OPT_USAGE_HIDDEN
static
const
cli_opt_spec
opts
[]
=
{
{
CLI_COMMON_OPT_HELP
},
{
CLI_COMMON_OPT_CONFIG
},
{
CLI_COMMON_OPT_CONFIG_ENV
},
CLI_COMMON_OPT
,
\
{
CLI_OPT_TYPE_SWITCH
,
"null"
,
'z'
,
&
null_separator
,
1
,
0
,
NULL
,
"use NUL as a separator"
},
...
...
src/cli/cmd_hash_object.c
View file @
90d3cc6c
...
...
@@ -19,9 +19,7 @@ static int write_object, read_stdin, literally;
static
char
**
filenames
;
static
const
cli_opt_spec
opts
[]
=
{
{
CLI_OPT_TYPE_SWITCH
,
"help"
,
0
,
&
show_help
,
1
,
CLI_OPT_USAGE_HIDDEN
|
CLI_OPT_USAGE_STOP_PARSING
,
NULL
,
"display help about the "
COMMAND_NAME
" command"
},
CLI_COMMON_OPT
,
{
CLI_OPT_TYPE_VALUE
,
NULL
,
't'
,
&
type_name
,
0
,
CLI_OPT_USAGE_DEFAULT
,
"type"
,
"the type of object to hash (default:
\"
blob
\"
)"
},
...
...
src/cli/cmd_help.c
View file @
90d3cc6c
...
...
@@ -16,8 +16,8 @@ static char *command;
static
int
show_help
;
static
const
cli_opt_spec
opts
[]
=
{
{
CLI_OPT_TYPE_SWITCH
,
"help"
,
0
,
&
show_help
,
1
,
CLI_OPT_USAGE_HIDDEN
,
NULL
,
"display help about the help command"
},
CLI_COMMON_OPT
,
{
CLI_OPT_TYPE_ARG
,
"command"
,
0
,
&
command
,
0
,
CLI_OPT_USAGE_DEFAULT
,
"command"
,
"the command to show help for"
},
{
0
},
...
...
src/cli/common.h
View file @
90d3cc6c
...
...
@@ -44,4 +44,23 @@ extern int cli_repository_open(
git_repository
**
out
,
cli_repository_open_options
*
opts
);
/*
* Common command arguments.
*/
#define CLI_COMMON_OPT_HELP \
CLI_OPT_TYPE_SWITCH, "help", 0, &show_help, 1, \
CLI_OPT_USAGE_HIDDEN | CLI_OPT_USAGE_STOP_PARSING
#define CLI_COMMON_OPT_CONFIG \
CLI_OPT_TYPE_VALUE, NULL, 'c', NULL, 0, \
CLI_OPT_USAGE_HIDDEN
#define CLI_COMMON_OPT_CONFIG_ENV \
CLI_OPT_TYPE_VALUE, "config-env", 0, NULL, 0, \
CLI_OPT_USAGE_HIDDEN
#define CLI_COMMON_OPT \
{ CLI_COMMON_OPT_HELP }, \
{ CLI_COMMON_OPT_CONFIG }, \
{ CLI_COMMON_OPT_CONFIG_ENV }
#endif
/* CLI_common_h__ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment