January 2021
sourcehut - sourcehut API client
sourcehut command [options …]
sourcehut is a command line program for interacting with the sourcehut API.
--access-token <token>
SOURCEHUT_CLI_ACCESS_TOKEN
environment variable. New tokens can be generated from your account’s OAuth settings page. If <token>
contains a forward slash, it is treated as a file containing an access token. Otherwise, <token>
should be the access token itself.
-n
, --max-results <count>
-o
, --output <format>
<format>
can be one of j
(for json
) or s
(the default), which generates S-expressions.
-h
, --help
--version
get jobs
get job <id>
get manifest <id>
cancel job <id>
create job
Create a new job from a manifest. Creating a job triggers a new pipeline on the sr.ht builds service. The new job will be started immediately, and will have access to build secrets. This command accepts the following arguments:
-f
, --manifest <input>
<input>
is “-”, a manifest is read from standard input. Note the input YAML will be submitted as-is, without validation.
-n
, --note <message>
-t
, --tags <tags>
get refs <repo>
create artifact <repo> <ref>
Attach an artifact to a reference in the given repository. This will upload the given file and make it available for download. This is often used to associate release artifacts with a given tag. This command accepts the following arguments:
-f
, --filename <input>
<input>
is “-”, the file is read from standard input.
-n
, --name <filename>
<input>
argument is used. This option is required when <input>
is read from standard input.
get profile
get audit-log
get ssh-keys
get pgp-keys
create ssh-key
Register a new SSH public key.
-f, --filename <input>
<input>
is “-”, the key is read from standard input.
create pgp-key
Register a new PGP public key.
-f, --filename <input>
<input>
is “-”, the key is read from standard input.
delete ssh-key <id>
<id>
should be the numeric ID of the key resource as shown by get ssh-keys
.
delete pgp-key <id>
<id>
should be the numeric ID of the key resource as shown by get pgp-keys
.
get pastes
get paste <sha>
get blob
.
get blob <id>
create paste
Create a new paste. This command accepts the following arguments:
-f
, --contents <input>
<input>
is “-”, paste content is read from standard input.
-n
, --name <name>
-v
, --visibility <level>
paste
create paste
command, but it prints a direct URL to the paste’s contents rather than a representation of the paste resource.
get trackers
get tracker <name>
get tickets <tracker>
get ticket <tracker> <id>
create ticket <tracker>
Create a ticket in the given tracker. The argument should be a tracker name, and both of the following options are required.
-f
, --description <input>
<input>
is “-”, the ticket description is read from standard input.
--title <title>
update ticket <tracker> <id>
Update an existing ticket. The arguments should be a tracker name and ticket ID, and at least one of the following options must be provided.
-f
, --comment <input>
--status <status>
--resolution <resolution>
get events <tracker> <id>
help
man(1)
. If that program could not be executed, display this program’s --help
text.
manual
Commands that retrieve a list of items will always start from the most recent. The total number of items can be controlled with the --max-results
or -n
flag, which expects a numeric argument specifying the number of items to retrieve. For example:
# retrieve the five most recent jobs
$ sourcehut get jobs -n 5
# retrieve the single most recent paste
$ sourcehut get pastes -n 1
The following variables can be used as an alternative to command line flags. They accept the same values and are validated in the same way. Any options given on the command line take precedence.
SOURCEHUT_CLI_OUTPUT
--output
option.
SOURCEHUT_CLI_MAX_RESULTS
--max-results
option.
SOURCEHUT_CLI_ACCESS_TOKEN
--access-token
option.