Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ BUILD_FLAGS := -tags "$(build_tags) $(GITOPIA_ENV)"
appname := git-remote-gitopia
version := 0.4.2

build = GOOS=$(1) GOARCH=$(2) go build $(BUILD_FLAGS) -o build/$(appname)$(3) ./cmd/git-remote-gitopia
tar = cd build && tar -cvzf $(appname)_$(version)_$(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3)
zip = cd build && zip $(appname)_$(version)_$(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3)
build = GOOS=$(1) GOARCH=$(2) go build $(BUILD_FLAGS) -o build/$(appname)$(3) ./cmd/git-remote-gitopia && \
GOOS=$(1) GOARCH=$(2) go build $(BUILD_FLAGS) -o build/git-gitopia$(3) ./cmd/git-gitopia
tar = cd build && tar -cvzf $(appname)_$(version)_$(1)_$(2).tar.gz $(appname)$(3) git-gitopia$(3) && \
rm $(appname)$(3) && rm git-gitopia$(3)
zip = cd build && zip $(appname)_$(version)_$(1)_$(2).zip $(appname)$(3) git-gitopia$(3) && \
rm $(appname)$(3) && rm git-gitopia$(3)

.PHONY: build

Expand Down Expand Up @@ -87,6 +90,7 @@ build/$(appname)_$(version)_windows_amd64.zip:
install: go.sum
@echo "--> Installing git-remote-gitopia"
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/git-remote-gitopia
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/git-gitopia

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
Expand Down
45 changes: 45 additions & 0 deletions cmd/git-gitopia/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package main

import (
"context"
"fmt"
"os"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/keys"
"github.com/cosmos/cosmos-sdk/version"
"github.com/spf13/cobra"

sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
// !!NOTE!! keep this same as remote helper app name
AppName = "git-remote-gitopia"
AccountAddressPrefix = "gitopia"
)

func main() {
ctx := context.Background()
ctx = context.WithValue(ctx, client.ClientContextKey, new(client.Context))
version.Name = AppName // os keyring service name is same as version name
cmd := &cobra.Command{
Use: "gitopia",
CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true},
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
conf := sdk.GetConfig()
conf.SetBech32PrefixForAccount(AccountAddressPrefix, AccountAddressPrefix+sdk.PrefixPublic)
conf.Seal()
initClientCtx := client.Context{}.WithInput(os.Stdin)
// sets global flags for keys subcommand
return client.SetCmdClientContextHandler(initClientCtx, cmd)
},
}
cmd.AddCommand(keys.Commands("."))
err := cmd.ExecuteContext(ctx)
if err != nil {
fmt.Fprint(os.Stderr, err.Error())
return
}
fmt.Fprintf(os.Stdout, "Done\n")
}
20 changes: 20 additions & 0 deletions cmd/git-gitopia/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# gitopia keys
git subcommand for managing gitopiad keys

## installation
```
make install
```

## Usage
use cosmos keys subcommand to manage keys
ex: recover key
```
git gitopia keys add <key-name> --recover
```

## configure key
```
git config --global gitopia.key <key-name>
git config --global gitopia.backend <keyring-backend>
```
Loading