Documentation
¶
Index ¶
- Variables
- func AskPassCmd(repo types.LocalRepo, args []string, stdout io.Writer) error
- func ConfigCmd(_ *config.AppConfig, repo types.LocalRepo, args *ConfigArgs) error
- func CreateCmd(cfg *config.AppConfig, args *CreateArgs) error
- func HookCmd(cfg *config.AppConfig, repo types.LocalRepo, args *HookArgs) error
- func VoteCmd(cfg *config.AppConfig, args *VoteArgs) error
- type ConfigArgs
- type CreateArgs
- type HookArgs
- type Remote
- type VoteArgs
Constants ¶
This section is empty.
Variables ¶
var RepoCmd = &cobra.Command{ Use: "repo", Short: "Create, find and manage repositories", Long: ``, Run: func(cmd *cobra.Command, args []string) { _ = cmd.Help() }, }
RepoCmd represents the repo command
Functions ¶
func AskPassCmd ¶
AskPassCmd handles git core.askPass calls.
We use this command to fetch push tokens that may have been created and signed by the pre-push hook during git push but cannot be used by git since git does not allow the connection to be altered in the pre-push hook phase. By returning the push token as a username via askPass utility, we can inject the token into the push request.
The command tries to find tokens that have been created and signed for remotes where one or more of its urls have matching hostname as the url git is requesting password for.
func CreateCmd ¶
func CreateCmd(cfg *config.AppConfig, args *CreateArgs) error
CreateCmd creates a transaction to create a repository
Types ¶
type ConfigArgs ¶
type ConfigArgs struct {
// Value is the transaction value
Value *float64
// Fee is the transaction fee to be paid by the signing key
Fee *float64
// Nonce is the next nonce of the signing account
Nonce *uint64
// SigningKey is the key that will be used to sign the transaction.
SigningKey *string
// SigningKeyPass is the passphrase for unlocking the signing key.
SigningKeyPass *string
// PushKey is the key that will be used sign push request
PushKey *string
// NoHook indicates that hooks should not be added
NoHook bool
// Remotes contain a list of git remotes to append to the repo.
Remotes []Remote
// RpcClient is the RPC client
RPCClient rpctypes.Client
// KeyUnlocker is a function for getting and unlocking a push key from keystore.
KeyUnlocker common.UnlockKeyFunc
// GetNextNonce is a function for getting the next nonce of an account
GetNextNonce api.NextNonceGetter
// CommandCreator creates a wrapped exec.Cmd object
CommandCreator util.CommandCreator
// PassAgentPort determines the port where the passphrase agent will bind to
PassAgentPort *string
// PassCacheTTL is the number of seconds a cached passphrase will live for.
PassCacheTTL string
// PassAgentSet is a function for sending set request to the agent service
PassAgentSet agent.SetFunc
// PassAgentUp is a function that checks if the agent server is running
PassAgentUp agent.IsUpFunc
Stderr io.Writer
Stdout io.Writer
}
ConfigArgs contains arguments for ConfigCmd.
type CreateArgs ¶
type CreateArgs struct {
// Name is the unique name of the repository
Name string
// Description is a short description of the repository
Description string
// configPath is the path to the repo config file or a JSON string
// to be decoded as the config.
Config string
// Nonce is the next nonce of the signing key's account
Nonce uint64
// Value the the amount of coins to transfer from the signer's account to the repo account.
Value float64
// Fee is the transaction fee to be paid by the signing key
Fee float64
// SigningKey is the account whose key will be used to sign the transaction.
SigningKey string
// SigningKeyPass is the passphrase for unlocking the signing key.
SigningKeyPass string
// RpcClient is the RPC client
RPCClient types.Client
// KeyUnlocker is a function for getting and unlocking a push key from keystore.
KeyUnlocker common.UnlockKeyFunc
// GetNextNonce is a function for getting the next nonce of an account
GetNextNonce api.NextNonceGetter
// CreateRepo is a function for generating a transaction for creating a repository
CreateRepo api.RepoCreator
// ShowTxStatusTracker is a function tracking and displaying tx status
ShowTxStatusTracker common.TxStatusTrackerFunc
Stdout io.Writer
}
CreateArgs contains arguments for CreateCmd.
type HookArgs ¶
type HookArgs struct {
*types3.SignCommitArgs
// Args is the command arguments
Args []string
// PostCommit when true indicates that the hook was called in a post-commit hook
PostCommit bool
// RpcClient is the RPC client
RPCClient types2.Client
// KeyUnlocker is a function for getting and unlocking a push key from keystore
KeyUnlocker common.UnlockKeyFunc
// GetNextNonce is a function for getting the next nonce of the owner account of a pusher key
GetNextNonce api.NextNonceGetter
// SetRemotePushToken is a function for creating, signing and applying a push token to a give remote
SetRemotePushToken server.MakeAndApplyPushTokenToRemoteFunc
CommitSigner types3.SignCommitFunc
TagSigner types3.SignTagFunc
NoteSigner types3.SignNoteFunc
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
}
type VoteArgs ¶
type VoteArgs struct {
// Name is the name of the repository
RepoName string
// ProposalID is the unique ID of the proposal
ProposalID string
// Vote is the vote choice
Vote int
// Nonce is the next nonce of the signing key's account
Nonce uint64
// Fee is the transaction fee to be paid by the signing key
Fee float64
// SigningKey is the account whose key will be used to sign the transaction.
SigningKey string
// SigningKeyPass is the passphrase for unlocking the signing key.
SigningKeyPass string
// RpcClient is the RPC client
RPCClient types.Client
// KeyUnlocker is a function for getting and unlocking a push key from keystore.
KeyUnlocker common.UnlockKeyFunc
// GetNextNonce is a function for getting the next nonce of an account
GetNextNonce api.NextNonceGetter
// CreateRepo is a function for generating a transaction for creating a repository
VoteCreator api.RepoProposalVoter
// ShowTxStatusTracker is a function tracking and displaying tx status
ShowTxStatusTracker common.TxStatusTrackerFunc
Stdout io.Writer
}
VoteArgs contains arguments for VoteCmd.