cmd

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Canon ggman.Command = canon{}

Canon is the 'ggman canon' command.

The 'ggman canon' command prints to standard output the canonical version of the URL passed as the first argument. An optional second argument determines the CANSPEC to use for canonizing the URL.

View Source
var Clone ggman.Command = clone{}

Clone is the 'ggman clone' command.

Clone clones the remote repository in the first argument into the path described to by 'ggman where'. It canonizes the url before cloning it. It optionally takes any argument that would be passed to the normal invocation of a git command.

When 'git' is not available on the system ggman is running on, additional arguments may not be supported.

View Source
var Comps ggman.Command = comps{}

Comps is the 'ggman comps' command.

When invoked, it prints the components of the first argument passed to it. Each component is printed on a separate line of standard output.

View Source
var Env ggman.Command = _env{}

Env is the 'ggman env' command.

Env prints "name=value" pairs about the environment the ggman command is running in to standard output. value is escaped for use in a shell.

By default, env prints information about all known variables. To print information about a subset of variables, they can be provided as positional arguments. Variables names are matched case-insensitively.

--list

Instead of printing "name=value" pairs, print only the name.

--describe

Instead of printing "name=value" pairs, print "name: description" pairs. The description explains what the value does.

--raw

Instead of printing "name=value" pairs, print only the raw, unescaped value.

View Source
var ErrExecFatal = exit.Error{
	ExitCode: exit.ExitGeneric,
}
View Source
var ErrExecNoParallelSimulate = exit.Error{
	ExitCode: exit.ExitCommandArguments,
	Message:  "`--simulate` expects `--parallel` to be 1, but got %d",
}
View Source
var ErrExecParalllelNegative = exit.Error{
	ExitCode: exit.ExitCommandArguments,
	Message:  "argument for `--parallel` must be non-negative",
}
View Source
var Exec ggman.Command = exe{}

Exec is the 'ggman exec' command.

Exec executes an external command for every repository known to ggman.

Each program is run with a working directory set to the root of the provided repository. Each program is inherits standard input, output and error streams from the ggman process.

Exec prints the path to the repository the command is being run in to standard error. By default, 'ggman exec' exits with the exit code as soon as the first program that does not return code 0. If all programs return code 0, 'ggman exec' also exits with code 0.

--simulate

Instead of actually running a command, print a bash script that would run them.

--parallel

Number of commands to run in parallel, 0 for no limit. Output will be shown on different status lines, except when parallel == 1.

--no-repo

Do not print name of repos command is being run in.

--quiet

Do not provide input or output streams to the command being run.

--force

Continue execution of programs, even if one returns a non-zero exit code. 'exec' will still return code 0 as the final exit code.

View Source
var Fetch ggman.Command = fetch{}

Fetch is the 'ggman fetch' command.

'ggman fetch' is the equivalent of running 'git fetch --all' on all locally cloned repositories.

View Source
var FindBranch ggman.Command = findBranch{}

FindBranch is the 'ggman find-branch' command.

The 'find-branch' command lists all repositories that contain a branch with the provided name. The remotes will be listed in dictionary order of their local installation paths.

--exit-code

When provided, exit with code 1 if no repositories are found.

View Source
var Fix ggman.Command = fix{}

Fix is the 'ggman fix' command.

The 'ggman fix' command canonicalizes the urls of all remotes of a repository.

--simulate

Instead of writing out the changes to disk, only print what would be done.

View Source
var Here ggman.Command = here{}

Here is the 'ggman here' command.

'ggman here' prints the path to the root of the repository in the current working directory to standard output.

--tree

When provided, also print the relative path from the root of the repository to the current path.

View Source
var License ggman.Command = license{}

License is the 'ggman license' command.

The license command prints to standard output legal notices about the ggman program.

View Source
var Link ggman.Command = link{}

Link is the 'ggman link' command.

The 'ggman link' symlinks the repository in the path passed as the first argument where it would have been cloned to inside 'ggman root'.

View Source
var Ls ggman.Command = ls{}

Ls is the 'ggman ls' command.

When called, the ggman ls command prints a list of paths to all locally cloned repositories to standard output.

--exit-code

When provided, exit with code 1 if no repositories are found.

--one

List at most one repository

View Source
var Lsr ggman.Command = lsr{}

Lsr is the 'ggman lsr' command.

When called, the ggman ls command prints a list of remotes of all locally cloned repositories to standard output. The remotes will be listed in dictionary order of their local installation paths.

--canonical

When provided, instead of printing the urls directly, prints the canonical remotes of all repositories

View Source
var Pull ggman.Command = pull{}

Pull is the 'ggman pull' command.

'ggman pull' is the equivalent of running 'git pull' on all locally installed repositories.

View Source
var Relocate ggman.Command = relocate{}

Relocate is the 'ggman relocate' command.

Relocate moves all repositories to the location where they should be moved to if they had been cloned with 'ggman clone'.

View Source
var Shellrc ggman.Command = shellrc{}

Shellrc is the 'ggman shellrc' command.

The 'ggman shellrc' command prints aliases to be used for shell profiles in conjunction with ggman.

View Source
var Sweep ggman.Command = sweep{}

Sweep is the 'ggman sweep' command.

The sweep command can be used to identify non-git directories within the GGROOT directory which are empty, or contain only subdirectories which are empty recursively. Such directories are left behind after running the 'ggman relocate' command, or after manually deleting repositories. The command takes no arguments, and produces them in an order such that they can be passed to 'rmdir' and be deleted.

View Source
var URL ggman.Command = urlweb{
	// contains filtered or unexported fields
}

URL is the 'ggman url' command.

The ggman url command behaves exactly like the ggman web command, except that instead of opening the URL in a web browser it prints it to standard output.

View Source
var Web ggman.Command = urlweb{
	// contains filtered or unexported fields
}

Web is the 'ggman web' command.

It attempts to open the url of the current repository in a browser. The browser being used is determined by the underlying operating system.

To determine the url it uses the CANSPEC `https://^/$`, which may not work with all git hosts. For instance when the url of the repository git@github.com:tkw1536/ggman.git, this will open the url https://github.com/tkw1536/ggman in a browser.

--force-repo-here

Instead of looking for a repository, always pretend there is one in the current directory. If the current directory is outside of the ggman root, this will cause an error. Use the path relative to the 'ggman root' as the URL to the repository.

--tree

This optional argument appends the string `/tree/$BRANCH/$PATH` to the url being opened, where $BRANCH is currently checked out branch and $PATH is the relative path from the repository root to the current folder. On common Git Hosts, such as GitHub and GitLab, this shows a page of the current folder on the current branch.

--branch

This argument works like '--tree', except that it does not append the local path to the url.

BASE

An optional argument of the form 'BASE'. If it is provided, the first component of the url is replace with the given base. For instance, using the base 'https://pkg.go.dev' would open the current repository on the golang documentation homepage. In addition to using a custom BASE, the following pre-defined bases 'travis' (TravisCI), 'circle' (CircleCI), 'godoc' (GoDoc) and 'localgodoc' (GoDoc when run on the local machine) can be used.

--prefix

When provided, instead of replacing the hostname with the base, prefix it with the base instead. This flag is ignored when no base is provided, or a built-in base is used.

--clone

When provided, instead of printing only the URL, print a 'git clone' command invocation that can be used by an anonymous user to clone the current repository. The clone url will always append '.git' to the web url, which may not work with every server. Only compatible with the '--branch' flag, but not '--tree', '--prefix', and 'BASE'.

--reclone

Like the --clone flag, but instead of using a normalized url, use the exact one found in the current repository.

View Source
var WebBuiltInBases = map[string]struct {
	URL         string
	IncludeHost bool
}{
	"travis":     {"https://travis-ci.com", false},
	"circle":     {"https://app.circleci.com/pipelines/github", false},
	"godoc":      {"https://pkg.go.dev/", true},
	"localgodoc": {"http://localhost:6060/pkg/", true},
}

WebBuiltInBases is a map of built-in bases for the url and web commands

View Source
var Where ggman.Command = where{}

Where is the 'ggman where' command.

When invoked, the ggman where command prints to standard output the location where the remote repository described by the first argument would be cloned to. This location is a subfolder of the directory outputted by 'ggman root'. Each segment of the path corresponding to a component of the repository url.

This command does not perform any interactions with the remote repository or the local disk, in particular it does not require access to the remote repository or require it to be installed.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
Command ggman is the main entry point into ggman.
Command ggman is the main entry point into ggman.

Jump to

Keyboard shortcuts

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