-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
110 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package command | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
) | ||
|
||
func Bin(_ context.Context, ev Env) error { | ||
fmt.Println(ev.Bin()) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package command | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
) | ||
|
||
func Initialize(_ context.Context, ev Env) error { | ||
fmt.Printf(`export PATH="%s:${PATH}"%s`, ev.Bin(), "\n") | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package gordon | ||
|
||
import ( | ||
"errors" | ||
"os" | ||
"strings" | ||
|
||
"github.com/kyoh86/gordon/internal/env" | ||
"github.com/zalando/go-keyring" | ||
) | ||
|
||
func SetGitHubToken(host, user, token string) error { | ||
if host == "" { | ||
return errors.New("host is empty") | ||
} | ||
if user == "" { | ||
return errors.New("user is empty") | ||
} | ||
return keyring.Set(strings.Join([]string{host, env.KeyringService}, "."), user, token) | ||
} | ||
|
||
func GetGitHubToken(host, user string) (string, error) { | ||
if user == "" { | ||
return "", errors.New("user is empty") | ||
} | ||
envar := os.Getenv("GORDON_GITHUB_TOKEN") | ||
if envar != "" { | ||
return envar, nil | ||
} | ||
return keyring.Get(strings.Join([]string{host, env.KeyringService}, "."), user) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters