mirror of
https://github.com/thomiceli/opengist.git
synced 2025-02-12 01:48:02 -05:00
Add git push option for description (#412)
This commit is contained in:
parent
662f553d37
commit
2ab9cf556f
2 changed files with 11 additions and 0 deletions
|
@ -17,6 +17,12 @@ git push -o title=Gist123
|
||||||
git push -o title="My Gist 123"
|
git push -o title="My Gist 123"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Change description
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git push -o description="This is my gist description"
|
||||||
|
```
|
||||||
|
|
||||||
## Change visibility
|
## Change visibility
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
|
@ -65,6 +65,11 @@ func PostReceive(in io.Reader, out, er io.Writer) error {
|
||||||
outputSb.WriteString(fmt.Sprintf("Gist title set to \"%s\"\n\n", opts["title"]))
|
outputSb.WriteString(fmt.Sprintf("Gist title set to \"%s\"\n\n", opts["title"]))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if opts["description"] != "" && validator.Var(opts["description"], "max=1000") == nil {
|
||||||
|
gist.Description = opts["description"]
|
||||||
|
outputSb.WriteString(fmt.Sprintf("Gist description set to \"%s\"\n\n", opts["description"]))
|
||||||
|
}
|
||||||
|
|
||||||
if hasNoCommits, err := git.HasNoCommits(gist.User.Username, gist.Uuid); err != nil {
|
if hasNoCommits, err := git.HasNoCommits(gist.User.Username, gist.Uuid); err != nil {
|
||||||
_, _ = fmt.Fprintln(er, "Failed to check if gist has no commits")
|
_, _ = fmt.Fprintln(er, "Failed to check if gist has no commits")
|
||||||
return fmt.Errorf("failed to check if gist has no commits: %w", err)
|
return fmt.Errorf("failed to check if gist has no commits: %w", err)
|
||||||
|
|
Loading…
Add table
Reference in a new issue