Skip to content

Commit 2bdbcb8

Browse files
committed
Remove repo completion for url+open subcommands
git hub url file<TAB> Since the argument can be a repo or a local file, we remove the repo completion here.
1 parent 17b277a commit 2bdbcb8

File tree

5 files changed

+13
-20
lines changed

5 files changed

+13
-20
lines changed

ReadMe.pod

+8-16
Original file line numberDiff line numberDiff line change
@@ -230,8 +230,7 @@ Most of the commands described below have arguments. This section defines each
230230
of the argument types. Note that argument values that are strings containing
231231
whitespace need to be quoted.
232232

233-
Argument variable names are always indicated by angle brackets, like: C<<
234-
<variable> >>. Arguments listed in square brackets are optional and arguments
233+
Argument variable names are always indicated by angle brackets, like: C<<<variable> >>. Arguments listed in square brackets are optional and arguments
235234
followed by C<...> indicate that more than one is allowed.
236235

237236
=over
@@ -577,8 +576,7 @@ issue instead of creating a new one.
577576

578577
If the default remote is a fork, the pull request will target the default
579578
branch of the parent repository. Otherwise the pull request will target the
580-
default branch of the default remote itself. Use C<--remote>, C<--branch>, C<--
581-
parent>, and C<--base> options to change the default source remote, source
579+
default branch of the default remote itself. Use C<--remote>, C<--branch>, C<--parent>, and C<--base> options to change the default source remote, source
582580
branch, target remote and target branch (respectively).
583581

584582
This command will open an editor like C<git commit> does. To avoid that you
@@ -709,17 +707,15 @@ This will create a gist with a file '.gitignore'
709707

710708
Search for repositories.
711709

712-
By default it searches in the repository name, but you can change that: C<search-
713-
repo "libyaml in:description">. For more information, see the search
710+
By default it searches in the repository name, but you can change that: C<search-repo "libyaml in:description">. For more information, see the search
714711
documentation at
715712
L<https://developer.github.com/v3/search/#search-repositories>
716713

717714
=item C<< search-user <query> >>
718715

719716
Search for users.
720717

721-
By default it searches in the login field, but you can change that: C<search-
722-
user "wall in:fullname">. For more information, see the search documentation
718+
By default it searches in the login field, but you can change that: C<search-user "wall in:fullname">. For more information, see the search documentation
723719
at L<https://developer.github.com/v3/search/#search-users>
724720

725721
=item C<< search-issues <query> >>
@@ -1000,8 +996,7 @@ these commands (the C<git hub setup> command automates this):
1000996

1001997
You can also see all your tokens on the web at L<thispage|https://github.com/settings/applications>.
1002998

1003-
You can specify your API token to C<git hub> on the commandline with C<--
1004-
token=...> or in the C<GIT_HUB_API_TOKEN> environment variable, but the
999+
You can specify your API token to C<git hub> on the commandline with C<--token=...> or in the C<GIT_HUB_API_TOKEN> environment variable, but the
10051000
easiest thing to do is just set it in the git-hub config.
10061001

10071002
Certain token B<scopes> are required for various GitHub API operations. Make
@@ -1050,8 +1045,7 @@ is stale, you may want to try these options:
10501045

10511046
=head1 Colors
10521047

1053-
You can have colored output. You can activate that by setting C<git hub config
1054-
color auto>. It accepts the same values as C<git config color.ui> itself.
1048+
You can have colored output. You can activate that by setting C<git hub configcolor auto>. It accepts the same values as C<git config color.ui> itself.
10551049

10561050
=head1 Examples
10571051

@@ -1108,11 +1102,9 @@ Assume your current working directory is not a GitHub repo:
11081102
$ # etc...
11091103

11101104
The C<git hub> command tries to be environmentally aware. If you are in a
1111-
GitHub cloned repo directory, and you don't specify C<< <user> >> or C<<
1112-
<owner> >> or C<< <repo> >> for a command that needs them, then they will be
1105+
GitHub cloned repo directory, and you don't specify C<< <user> >> or C<<<owner> >> or C<< <repo> >> for a command that needs them, then they will be
11131106
pulled from the remote url. Otherwise, if you don't specify a C<< <user> >> it
1114-
will use the one (presumably yours) that you set with the C<git hub config
1115-
login ...> command.
1107+
will use the one (presumably yours) that you set with the C<git hub configlogin ...> command.
11161108

11171109
=head2 Example 3. Building Complex Commands
11181110

man/man1/git-hub.1

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
1+
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.35)
22
.\"
33
.\" Standard preamble:
44
.\" ========================================================================
@@ -71,7 +71,7 @@
7171
.\" ========================================================================
7272
.\"
7373
.IX Title "STDIN 1"
74-
.TH STDIN 1 "July 2022" "Generated by Swim v0.1.48" "The Git command for GitHub"
74+
.TH STDIN 1 "August 2022" "Generated by Swim v0.1.48" "The Git command for GitHub"
7575
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
7676
.\" way too many mistakes in technical documents.
7777
.if n .ad l

share/completion.bash

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
_git_hub() {
66
local _opts=" -h --help --remote= --branch= --sha= --org= --method= --title= --msg= -c= --count= -a --all -q --quiet -v --verbose -r --raw -j --json -A --use-auth -C --no-cache --token= -d --dryrun -T -O -H -J -R -x"
77
local subcommands="cache-clear clone collabs comment config config-keys config-list config-unset follow followers following follows fork forks gist gist-clone gist-delete gist-edit gist-fork gist-get gist-init gist-new gist-star gist-unstar gists git-hub-travis help info irc-enable irc-enable irc-url issue issue-close issue-edit issue-new issue-resolve issues keys keys-add member-add member-get member-remove members notify-list open org org-edit org-get org-members org-repos orgs pr-created pr-diff pr-fetch pr-involves pr-list pr-merge pr-new pr-queue repo repo-delete repo-edit repo-get repo-init repo-new repos scope-add scope-remove scopes search-issues search-repo search-user setup star starred stars team team-delete team-members team-new team-repo-add team-repos teams token-delete token-get token-new tokens trust unfollow unstar untrust unwatch upgrade url user user-edit user-get version watch watchers watching"
8-
local repocommands="clone collabs comment fork forks issue issue-close issue-edit issue-new issue-resolve issues open pr-diff pr-fetch pr-list pr-merge repo repo-delete repo-edit repo-get star stars trust unstar untrust unwatch url watch watchers"
8+
local repocommands="clone collabs comment fork forks issue issue-close issue-edit issue-new issue-resolve issues pr-diff pr-fetch pr-list pr-merge repo repo-delete repo-edit repo-get star stars trust unstar untrust unwatch watch watchers"
99
local subcommand="$(__git_find_on_cmdline "$subcommands")"
1010

1111
if [ -z "$subcommand" ]; then

share/zsh-completion/_git-hub

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ _git-hub() {
5454
;;
5555
repo)
5656
case $line[1] in
57-
clone|collabs|comment|fork|forks|issue|issue-close|issue-edit|issue-new|issue-resolve|issues|open|pr-diff|pr-fetch|pr-list|pr-merge|repo|repo-delete|repo-edit|repo-get|star|stars|trust|unstar|untrust|unwatch|url|watch|watchers)
57+
clone|collabs|comment|fork|forks|issue|issue-close|issue-edit|issue-new|issue-resolve|issues|pr-diff|pr-fetch|pr-list|pr-merge|repo|repo-delete|repo-edit|repo-get|star|stars|trust|unstar|untrust|unwatch|watch|watchers)
5858
[[ "$line[2]" =~ ^- ]] && return;
5959
local repo_to_complete="$line[2]"
6060
if [[ "$repo_to_complete" =~ "^@/?$" || \

tool/generate-completion.pl

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ sub main {
4949
or die "Bad usage: '$text'";
5050
(my $name = $usage) =~ s/ .*//;
5151
push @list, $name;
52+
next if $name =~ m/^(open|url)$/; # arg can also be a local file
5253
if ($usage =~ m#\Q$name\E \(?\[?(<owner>/)?\]?<repo>#) {
5354
push @repo_cmds, $name;
5455
}

0 commit comments

Comments
 (0)