forked from APACGAMONDE/Gift-Card-Trade-in
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gh-alias-set.1
87 lines (62 loc) · 2.26 KB
/
gh-alias-set.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
.nh
.TH "gh" "1" "Jun 2021" "" ""
.SH NAME
.PP
gh\-alias\-set \- Create a shortcut for a gh command
.SH SYNOPSIS
.PP
\fBgh alias set [flags]\fP
.SH DESCRIPTION
.PP
Declare a word as a command alias that will expand to the specified command(s).
.PP
The expansion may specify additional arguments and flags. If the expansion
includes positional placeholders such as '$1', '$2', etc., any extra arguments
that follow the invocation of an alias will be inserted appropriately.
Reads from STDIN if '\-' is specified as the expansion parameter. This can be useful
for commands with mixed quotes or multiple lines.
.PP
If '\-\-shell' is specified, the alias will be run through a shell interpreter (sh). This allows you
to compose commands with "|" or redirect with ">". Note that extra arguments following the alias
will not be automatically passed to the expanded expression. To have a shell alias receive
arguments, you must explicitly accept them using "$1", "$2", etc., or "$@" to accept all of them.
.PP
Platform note: on Windows, shell aliases are executed via "sh" as installed by Git For Windows. If
you have installed git on Windows in some other way, shell aliases may not work for you.
.PP
Quotes must always be used when defining a command as in the examples unless you pass '\-'
as the expansion parameter and pipe your command to 'gh alias set'.
.SH OPTIONS
.PP
\fB\-s\fP, \fB\-\-shell\fP[=false]
Declare an alias to be passed through a shell interpreter
.SH OPTIONS INHERITED FROM PARENT COMMANDS
.PP
\fB\-\-help\fP[=false]
Show help for command
.SH EXAMPLE
.PP
.RS
.nf
$ gh alias set pv 'pr view'
$ gh pv \-w 123
#=> gh pr view \-w 123
$ gh alias set bugs 'issue list \-\-label="bugs"'
$ gh bugs
$ gh alias set homework 'issue list \-\-assignee @me'
$ gh homework
$ gh alias set epicsBy 'issue list \-\-author="$1" \-\-label="epic"'
$ gh epicsBy vilmibm
#=> gh issue list \-\-author="vilmibm" \-\-label="epic"
$ gh alias set \-\-shell igrep 'gh issue list \-\-label="$1" | grep $2'
$ gh igrep epic foo
#=> gh issue list \-\-label="epic" | grep "foo"
# users.txt contains multiline 'api graphql \-F name="$1" ...' with mixed quotes
$ gh alias set users \- < users.txt
$ gh users octocat
#=> gh api graphql \-F name="octocat" ...
.fi
.RE
.SH SEE ALSO
.PP
\fBgh\-alias(1)\fP