|
1 year ago | |
---|---|---|
cmd | 3 years ago | |
.go-gogs-cli.example.yaml | 6 years ago | |
LICENSE | 1 year ago | |
README.md | 1 year ago | |
go.mod | 1 year ago | |
go.sum | 3 years ago |
Accesses the Gogs Client API, which is currently available exclusively on Gogs' develop
branch.
Cobra & Viper go packages handle the hard work for the CLI interface.
go get go.adphi.net/gogs-cli/...
go install go.adphi.net/gogs-cli/cmd/gogs
Once you've got the project, you'll need to configure your own GOGS_TOKEN
and GOGS_URL
variables.
You can use a file called .gogs.yaml
that likes to live at $HOME/.gogs.yaml
. It handles configuring your Gogs url and token, like such:
GOGS_TOKEN: 0e6709o05da4753dddf5f592374fdc263f02n801
GOGS_URL: http://my.goggers.me
Make that file (there's an example in the repo) and fill that in for your own self.
Or, if you'd rather use environment variables, that'll work fine too.
export GOGS_TOKEN=asdlfj239r029fzsfasf923r23f
export GOGS_URL=http://my.goggers.me
So far, you can do things. What's that? You can do things? Yep! Do things!
# Create basic:
$ gogs repo create wheres-waldo # Create a repo owned by you.
# Create fancy:
$ gogs repo create Gophers/wheres-waldo --desc='awesome stuff' --private
$ gogs repo create where-waldo -r origin
# [Aliases] for create.
$ gogs repo [create|new|c|n]
# [Options] for create.
# [-d | --desc] # Description
# [-p | --private] # Make repo private
# [-r | --add-remote] # Add newly created gogs repo as a remote to your current git dir, initalizing git if necessary
# Migrate:
$ gogs repo migrate <myusername or my org's username>/mirror-mirror https://github.com/gogits/gogs.git
# [Aliases] for migrate
$ gogs repo [migrate|m]
# [Options] for migrate
# [-m | --mirror] # Make it a mirror of the original.
# [-p | --private] # Make it private.
# List basic:
$ gogs repo list # Get all yo repos.
# [Aliases]
$ gogs repo [list|l]
# Search basic:
$ gogs repo search waldo # Search public repos for keyword 'waldo'.
# Search fancy:
$ gogs repo search waldo --limit 1 --user thatguy
# [Aliases] for search.
$ gogs repo [search|find|s|f]
# [Options] for search.
# [-l | --limit] # Limit results
# [-u | --user] # By user, required if you want to search private repos
# Destroy basic:
$ gogs repo destroy irstacks my-exterminable-repo
$ gogs repo destroy irstacks/my-other-exterminable-repo
# [Aliases] for destroy.
$ gogs repo [destroy|delete|d|rid]
# Help?!
# Add --help after any command to see what's up, ie.
$ gogs --help
$ gogs repo --help
$ gogs repo create --help
# and so on...
Oh, you're hot shit and use n > 1 Gogs? Sweet.
You can override your api and token by flagging a config file with the --config
flag (like such)
$ gogs --config="$HOME/sneaky/place/.gogs.yaml" repo create newjunk
or, override your api url and token individually on the fly with flags --token
and --url
for any command, like so:
$ gogs --url=http://some.other.company --token=qo23ransdlfknaw3oijr2323rasldf repo search waldo
You may have noticed that we're pretty heavy on the gogs repo
and pretty light on the gogs somethingelse
side of things. The Gogs Client API makes a bunch of endpoints and methods accessible for Users, Organizations, Issues, Admins, and so forth (although it's still very much a work in progress). Myself, I mostly just want to be able to create, search, and destroy like a fiend. If you would :heart: something and are unable to help yourself, let me know by opening an issue.