blob: e2e71ff9e844c63cdae0877b6d650526a7bb3d28 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= gerrit ls-projects
Shawn O. Pearce4016a932009-05-28 15:12:40 -07002
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08003== NAME
Shawn O. Pearce4016a932009-05-28 15:12:40 -07004gerrit ls-projects - List projects visible to caller
5
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08006== SYNOPSIS
Michael Ochmanne2d76a12016-06-23 17:07:37 +02007[verse]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -08008--
Michael Ochmanne2d76a12016-06-23 17:07:37 +02009_ssh_ -p <port> <host> _gerrit ls-projects_
Shawn O. Pearce47769242011-06-14 16:40:48 -070010 [--show-branch <BRANCH> ...]
Edwin Kempin73b26982012-07-16 13:53:22 +020011 [--description | -d]
12 [--tree | -t]
Shawn O. Pearce47769242011-06-14 16:40:48 -070013 [--type {code | permissions | all}]
Edwin Kempin73b26982012-07-16 13:53:22 +020014 [--format {text | json | json_compact}]
15 [--all]
16 [--limit <N>]
Edwin Kempinf0c70422012-08-24 15:34:20 +020017 [--has-acl-for GROUP]
Yuxuan 'fishy' Wangd85b6872013-11-15 11:47:46 -080018--
Shawn O. Pearce4016a932009-05-28 15:12:40 -070019
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080020== DESCRIPTION
Shawn O. Pearce4016a932009-05-28 15:12:40 -070021Displays the list of project names, one per line, that the
22calling user account has been granted 'READ' access to.
23
24If the caller is a member of the privileged 'Administrators'
25group, all projects are listed.
26
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080027== ACCESS
Shawn O. Pearcea0418982012-04-05 09:10:02 -070028Any user who has configured an SSH key, or by an user over HTTP.
Shawn O. Pearce4016a932009-05-28 15:12:40 -070029
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080030== SCRIPTING
Shawn O. Pearce4016a932009-05-28 15:12:40 -070031This command is intended to be used in scripts.
32
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080033== OPTIONS
Shawn O. Pearce47769242011-06-14 16:40:48 -070034--show-branch::
35-b::
Anatol Pomazau37395692011-05-24 06:50:38 -070036 Branch for which the command will display the sha of each project.
Shawn O. Pearce47769242011-06-14 16:40:48 -070037 The command may have multiple --show-branch parameters, in this case
Anatol Pomazau37395692011-05-24 06:50:38 -070038 sha will be shown for each of the branches.
39 If the user does not have READ access to some branch or the branch does not
Shawn O. Pearce47769242011-06-14 16:40:48 -070040 exist then stub (40 `-` symbols) is shown.
Anatol Pomazau37395692011-05-24 06:50:38 -070041 If the user does not have access to any branch in the project then the
42 whole project is not shown.
Nico Sallembien0d6312d2010-03-15 14:48:44 -070043
Gustaf Lundh87cea022011-09-01 15:56:59 +020044--description::
Edwin Kempin73b26982012-07-16 13:53:22 +020045-d::
Gustaf Lundh87cea022011-09-01 15:56:59 +020046 Allows listing of projects together with their respective
47 description.
Edwin Kempin9ad27612011-11-21 10:59:25 +010048+
Magnus Bäck21f533a2012-03-22 09:55:03 -040049For text format output, all non-printable characters (ASCII value 31 or
50less) are escaped according to the conventions used in languages like C,
51Python, and Perl, employing standard sequences like `\n` and `\t`, and
52`\xNN` for all others. In shell scripts, the `printf` command can be
53used to unescape the output.
Gustaf Lundh87cea022011-09-01 15:56:59 +020054
Shawn O. Pearce47769242011-06-14 16:40:48 -070055--tree::
56-t::
lincoln5bfabe52010-05-31 16:23:53 -030057 Displays project inheritance in a tree-like format.
58 This option does not work together with the show-branch option.
59
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070060--type::
Shawn O. Pearce47769242011-06-14 16:40:48 -070061 Display only projects of the specified type. If not
Hugo Arès7e45a462016-03-02 14:11:05 -050062 specified, defaults to `all`. Supported types:
Shawn O. Pearce7b825b32012-04-05 09:10:41 -070063+
64--
65`code`:: Any project likely to contain user files.
66`permissions`:: Projects created with the `--permissions-only` flag.
67`all`:: Any type of project.
68--
Edwin Kempinf179be22011-09-22 14:34:02 +020069
Shawn O. Pearceec9efd72012-04-04 20:44:39 -070070--format::
71 What output format to display the results in.
72+
73--
74`text`:: Simple text based format.
75`json`:: Map of JSON objects describing each project.
76`json_compact`:: Minimized JSON output.
77--
78
Edwin Kempinf179be22011-09-22 14:34:02 +020079--all::
80 Display all projects that are accessible by the calling user
81 account. Besides the projects that the calling user account has
82 been granted 'READ' access to, this includes all projects that
83 are owned by the calling user account (even if for these projects
84 the 'READ' access right is not assigned to the calling user
85 account).
Shawn O. Pearce7fdf53e2011-06-14 14:52:59 -070086
Shawn O. Pearce5cd05772012-04-07 13:47:18 -070087--limit::
88 Cap the number of results to the first N matches.
89
Edwin Kempinf0c70422012-08-24 15:34:20 +020090--has-acl-for::
91 Display only projects on which access rights for this group are
92 directly assigned. Projects which only inherit access rights for
93 this group are not listed.
94+
95With this option you can find out on which projects a group is used.
96
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080097== HTTP
Shawn O. Pearcea0418982012-04-05 09:10:02 -070098This command is also available over HTTP, as `/projects/` for
99anonymous access and `/a/projects/` for authenticated access.
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700100Named options are available as query parameters. Results can
101be limited to projects matching a prefix by supplying the prefix
102as part of the URL, for example `/projects/external/` lists only
103projects whose name start with the string `external/`.
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700104
Shawn O. Pearceec9efd72012-04-04 20:44:39 -0700105Over HTTP the `json_compact` output format is assumed if the client
106explicitly asks for JSON using HTTP header `Accept: application/json`.
107When any JSON output format is used on HTTP, readers must skip the
108first line produced. The first line is a garbage JSON string crafted
109to prevent a browser from executing the response in a script tag.
110
111Output will be gzip compressed if `Accept-Encoding: gzip` was used
112by the client in the request headers.
113
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800114== EXAMPLES
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700115
116List visible projects:
Michael Ochmannb99feab2016-07-06 14:10:22 +0200117----
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700118 $ ssh -p 29418 review.example.com gerrit ls-projects
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700119 platform/manifest
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700120 tools/gerrit
121 tools/gwtorm
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700122
123 $ curl http://review.example.com/projects/
Shawn O. Pearce5cd05772012-04-07 13:47:18 -0700124 platform/manifest
125 tools/gerrit
126 tools/gwtorm
127
128 $ curl http://review.example.com/projects/tools/
Shawn O. Pearcea0418982012-04-05 09:10:02 -0700129 tools/gerrit
130 tools/gwtorm
Michael Ochmannb99feab2016-07-06 14:10:22 +0200131----
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700132
133Clone any project visible to the user:
Michael Ochmannb99feab2016-07-06 14:10:22 +0200134----
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700135 for p in `ssh -p 29418 review.example.com gerrit ls-projects`
136 do
137 mkdir -p `dirname "$p"`
138 git clone --bare "ssh://review.example.com:29418/$p.git" "$p.git"
139 done
Michael Ochmannb99feab2016-07-06 14:10:22 +0200140----
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700141
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -0800142== SEE ALSO
Shawn O. Pearce4016a932009-05-28 15:12:40 -0700143
144* link:access-control.html[Access Controls]
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700145
146GERRIT
147------
148Part of link:index.html[Gerrit Code Review]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -0700149
150SEARCHBOX
151---------