cli

package module
v1.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 15 Imported by: 0

README

threepipes

ccienv

A management tool for CircleCI Project's environment variables.
(Currently, only available on GitHub)

This repository will be supported until the official circleci-cli will support the project's variables management: issue

Installation

$ go install github.com/threepipes/circleci-env/cmd/ccienv@latest
Uninstallation
$ rm $(which ccienv)

Requirements

  • golang
  • git
    • Only if load repository name from .git

Setup

$ ccienv config init

Set these variables.

  • CircleCI API Token
    • A personal API token of CircleCI
  • GitHub organization
    • GitHub organization name or GitHub username of your repository

Then, $XDG_CONFIG_HOME/ccienv/config.yml will be created.

Run

$ ccienv -r <your_repo_name> <cmd> [<args>]

If -r <your_repo_name> is omitted, the origin URL of the current directory's git project is used to specify the target repository.
It is the same as the result of git config --get remote.origin.url. Then, you can use ccienv like this.

# You have to be in a directory of a target repository
$ ccienv ls
Example
# list variables
$ ccienv -r circleci-env ls

# Add a variable
$ ccienv add TEST_ENV somevalue

# Add variables by a file or stdin
$ ccienv addi -f envs.json -t json

# Delete variables interactive
$ ccienv rm -i

Help

You can find more information by this command.

$ ccienv -h

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteConfig

func WriteConfig(conf *Config) error

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cfg *Config, prj string) (*Client, error)

func (*Client) DeleteVariables

func (c *Client) DeleteVariables(ctx context.Context, vars []string) error

func (*Client) DeleteVariablesInteractive

func (c *Client) DeleteVariablesInteractive(ctx context.Context) error

func (*Client) ListVariables

func (c *Client) ListVariables(ctx context.Context) error

func (*Client) ShowProject

func (c *Client) ShowProject(ctx context.Context) error

func (*Client) UpdateOrCreateVariable

func (c *Client) UpdateOrCreateVariable(ctx context.Context, key string, val string) error

func (*Client) UpdateOrCreateVariablesFromFile added in v1.5.0

func (c *Client) UpdateOrCreateVariablesFromFile(ctx context.Context, path string, filetype string) (err error)

UpdateOrCreateVariablesFromFile updates environmental variables by reading a file or stdin If the path is empty, stdin will be used as input

type Config

type Config struct {
	ApiToken         string `split_words:"true"`
	OrganizationName string `split_words:"true"`
}

func ReadConfig

func ReadConfig() (*Config, error)

type FileType added in v1.5.0

type FileType uint16
const (
	FileTypeUnknown FileType = iota
	FileTypeJson
	FileTypeDotenv
)

type Prompt

type Prompt struct {
}

func (*Prompt) ReadAll added in v1.5.0

func (p *Prompt) ReadAll(msg string) (string, error)

func (*Prompt) ReadLine added in v1.5.0

func (p *Prompt) ReadLine(msg string) (string, error)

func (*Prompt) ReadSecret

func (p *Prompt) ReadSecret(msg string) (string, error)

func (*Prompt) SelectFromList

func (p *Prompt) SelectFromList(msg string, ls []string) ([]string, error)

func (*Prompt) YesNo

func (p *Prompt) YesNo(msg string) (bool, error)

type UI

type UI interface {
	YesNo(msg string) (bool, error)
	SelectFromList(msg string, ls []string) ([]string, error)
	ReadSecret(msg string) (string, error)
	ReadLine(msg string) (string, error)
	ReadAll(msg string) (string, error)
}

Directories

Path Synopsis
cmd
mock
cli
Package mock_cli is a generated GoMock package.
Package mock_cli is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL