Documentation
¶
Overview ¶
Package cli holds what the subcommands do, once internal/app has parsed their arguments.
Package cli holds what the subcommands do, once internal/app has parsed their arguments. What a command is asked for goes to stdout; what it has to say about how that went goes to stderr.
Index ¶
- Variables
- func Auth(ctx context.Context, stdout, stderr io.Writer, source string, c AccessChecker) int
- type AccessChecker
- type CLI
- func (c *CLI) Clone(ctx context.Context, arg, dir string) error
- func (c *CLI) Delete(ctx context.Context, args []string, yes bool) error
- func (c *CLI) Edit(ctx context.Context, arg, file string, o EditOptions) error
- func (c *CLI) List(ctx context.Context, o ListOptions) error
- func (c *CLI) New(ctx context.Context, paths []string, o NewOptions) error
- func (c *CLI) NewInForm(ctx context.Context, o NewOptions, form func() (*model.Gist, error)) error
- func (c *CLI) OpenGist(ctx context.Context, arg string) error
- func (c *CLI) Resolve(ctx context.Context, arg string) (string, error)
- func (c *CLI) View(ctx context.Context, arg, file string, o ViewOptions) error
- type EditOptions
- type ListOptions
- type NewOptions
- type ViewOptions
Constants ¶
This section is empty.
Variables ¶
var ErrCanceled = errors.New("canceled")
ErrCanceled says the user said no. The exit code is 130 and nothing more is printed.
var ErrFileWithFlags = errors.New("a file name goes with piped content, not with -d, --add, --remove or --rename")
ErrFileWithFlags says a file to replace was named along with flags, which take no content.
var ErrNothingToCreate = errors.New("give files to create the gist from, or pipe the content")
ErrNothingToCreate says gist new was given nothing to read.
Functions ¶
Types ¶
type AccessChecker ¶
AccessChecker says what the token can do.
type CLI ¶
type CLI struct {
Stdin io.Reader
Stdout, Stderr io.Writer
// StdinTTY and StdoutTTY say they are terminals.
StdinTTY, StdoutTTY bool
API *github.Client
Editor *edit.Editor
Log *slog.Logger
// Open opens a URL in the browser.
Open func(url string) error
// Run runs a program on the user's terminal.
Run func(name string, args ...string) error
// EditorCommand is the editor set in the config.
EditorCommand string
// CacheDir is where lists and contents are kept.
CacheDir string
// Now is the time.
Now func() time.Time
// contains filtered or unexported fields
}
CLI is what the commands run with.
func (*CLI) Clone ¶
Clone clones a gist with git, the way to work on images and many files, which the API cannot carry.
func (*CLI) Delete ¶
Delete removes gists, asking first on a terminal. Nothing is removed unless every one of them can be found.
func (*CLI) List ¶
func (c *CLI) List(ctx context.Context, o ListOptions) error
List prints the list of gists.
type EditOptions ¶
type EditOptions struct {
Description *string
Add []string
Remove []string
Rename []string
// Base and BaseDescription say what the change must be based on.
Base string
BaseDescription *string
// Yes sends what was edited without asking, and Force goes over what
// changed on GitHub.
Yes, Force bool
}
EditOptions are the flags of gist edit.
type ListOptions ¶
ListOptions are the flags of gist list.
type NewOptions ¶
NewOptions are the flags of gist new.
type ViewOptions ¶
type ViewOptions struct {
Files, JSON, Web bool
}
ViewOptions are the flags of gist view.