Skip to content

Commit

Permalink
Update README and Usage
Browse files Browse the repository at this point in the history
  • Loading branch information
justjanne committed Oct 18, 2017
1 parent 1f8357a commit a4bb002
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 66 deletions.
66 changes: 33 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,54 +128,54 @@ in your shell’s init file.
```
Usage of powerline-go:
-colorize-hostname
Colorize the hostname based on a hash of itself
Colorize the hostname based on a hash of itself
-cwd-max-depth int
Maximum number of directories to show in path
(default 5)
Maximum number of directories to show in path
(default 5)
-cwd-max-dir-size int
Maximum number of letters displayed for each directory in the path
(default -1)
Maximum number of letters displayed for each directory in the path
(default -1)
-cwd-mode string
How to display the current directory
(valid choices: fancy, plain, dironly)
(default "fancy")
How to display the current directory
(valid choices: fancy, plain, dironly)
(default "fancy")
-east-asian-width
Use East Asian Ambiguous Widths
Use East Asian Ambiguous Widths
-error int
Exit code of previously executed command
Exit code of previously executed command
-ignore-repos string
A list of git repos to ignore. Separate with ','
Repos are identified by their root directory.
A list of git repos to ignore. Separate with ','
Repos are identified by their root directory.
-max-width int
Maximum width of the shell that the prompt may use, in percent. Setting this to 0 disables the shrinking subsystem.
(default 50)
Maximum width of the shell that the prompt may use, in percent. Setting this to 0 disables the shrinking subsystem.
(default 50)
-mode string
The characters used to make separators between segments.
(valid choices: patched, compatible, flat)
(default "patched")
The characters used to make separators between segments.
(valid choices: patched, compatible, flat)
(default "patched")
-modules string
The list of modules to load, separated by ','
(valid choices: aws, cwd, docker, dotenv, exit, git, gitlite, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)
(default "venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,root")
The list of modules to load, separated by ','
(valid choices: aws, cwd, docker, dotenv, exit, git, gitlite, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)
(default "venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,root")
-newline
Show the prompt on a new line
Show the prompt on a new line
-priority string
Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','
(valid choices: aws, cwd, cwd-path, docker, exit, git-branch, git-status, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)
(default "root,cwd,user,host,ssh,perms,git-branch,git-status,hg,jobs,exit,cwd-path")
Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','
(valid choices: aws, cwd, cwd-path, docker, exit, git-branch, git-status, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)
(default "root,cwd,user,host,ssh,perms,git-branch,git-status,hg,jobs,exit,cwd-path")
-shell string
Set this to your shell type
(valid choices: bare, bash, zsh)
(default "bash")
Set this to your shell type
(valid choices: bare, bash, zsh)
(default "bash")
-shorten-gke-names
Shortens names for GKE Kube clusters.
Shortens names for GKE Kube clusters.
-theme string
Set this to the theme you want to use
(valid choices: default, low-contrast)
(default "default")
Set this to the theme you want to use
(valid choices: default, low-contrast)
(default "default")
-truncate-segment-width int
Minimum width of a segment, segments longer than this will be shortened if space is limited. Setting this to 0 disables it.
(default 16)
Minimum width of a segment, segments longer than this will be shortened if space is limited. Setting this to 0 disables it.
(default 16)
```


Expand Down
64 changes: 31 additions & 33 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,89 +104,87 @@ var modules = map[string](func(*powerline)){
"venv": segmentVirtualEnv,
}

func comments(lines ...string) string {
return " " + strings.Join(lines, "\n"+" \t ")
}

func commentsWithDefaults(lines ...string) string {
return comments(lines...) + "\n" + " \t"
}

func main() {
args := args{
CwdMode: flag.String(
"cwd-mode",
"fancy",
"How to display the current directory\n"+
" (valid choices: fancy, plain, dironly)\n"+
" "),
commentsWithDefaults("How to display the current directory",
"(valid choices: fancy, plain, dironly)")),
CwdMaxDepth: flag.Int(
"cwd-max-depth",
5,
"Maximum number of directories to show in path\n"+
" "),
commentsWithDefaults("Maximum number of directories to show in path")),
CwdMaxDirSize: flag.Int(
"cwd-max-dir-size",
-1,
"Maximum number of letters displayed for each directory in the path\n"+
" "),
commentsWithDefaults("Maximum number of letters displayed for each directory in the path")),
ColorizeHostname: flag.Bool(
"colorize-hostname",
false,
"Colorize the hostname based on a hash of itself"),
comments("Colorize the hostname based on a hash of itself")),
EastAsianWidth: flag.Bool(
"east-asian-width",
false,
"Use East Asian Ambiguous Widths"),
comments("Use East Asian Ambiguous Widths")),
PromptOnNewLine: flag.Bool(
"newline",
false,
"Show the prompt on a new line"),
comments("Show the prompt on a new line")),
Mode: flag.String(
"mode",
"patched",
"The characters used to make separators between segments.\n"+
" (valid choices: patched, compatible, flat)\n"+
" "),
commentsWithDefaults("The characters used to make separators between segments.",
"(valid choices: patched, compatible, flat)")),
Theme: flag.String(
"theme",
"default",
"Set this to the theme you want to use\n"+
" (valid choices: default, low-contrast)\n"+
" "),
commentsWithDefaults("Set this to the theme you want to use",
"(valid choices: default, low-contrast)")),
Shell: flag.String(
"shell",
"bash",
"Set this to your shell type\n"+
" (valid choices: bare, bash, zsh)\n"+
" "),
commentsWithDefaults("Set this to your shell type",
"(valid choices: bare, bash, zsh)")),
Modules: flag.String(
"modules",
"venv,user,host,ssh,cwd,perms,git,hg,jobs,exit,root",
"The list of modules to load, separated by ','\n"+
" (valid choices: aws, cwd, docker, dotenv, exit, git, gitlite, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)\n"+
" "),
commentsWithDefaults("The list of modules to load, separated by ','",
"(valid choices: aws, cwd, docker, dotenv, exit, git, gitlite, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)")),
Priority: flag.String(
"priority",
"root,cwd,user,host,ssh,perms,git-branch,git-status,hg,jobs,exit,cwd-path",
"Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','\n"+
" (valid choices: aws, cwd, cwd-path, docker, exit, git-branch, git-status, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)\n"+
" "),
commentsWithDefaults("Segments sorted by priority, if not enough space exists, the least priorized segments are removed first. Separate with ','",
"(valid choices: aws, cwd, cwd-path, docker, exit, git-branch, git-status, hg, host, jobs, perlbrew, perms, root, ssh, time, user, venv)")),
MaxWidthPercentage: flag.Int(
"max-width",
50,
"Maximum width of the shell that the prompt may use, in percent. Setting this to 0 disables the shrinking subsystem.\n"+
" "),
commentsWithDefaults("Maximum width of the shell that the prompt may use, in percent. Setting this to 0 disables the shrinking subsystem.")),
TruncateSegmentWidth: flag.Int(
"truncate-segment-width",
16,
"Minimum width of a segment, segments longer than this will be shortened if space is limited. Setting this to 0 disables it.\n"+
" "),
commentsWithDefaults("Minimum width of a segment, segments longer than this will be shortened if space is limited. Setting this to 0 disables it.")),
PrevError: flag.Int(
"error",
0,
"Exit code of previously executed command"),
comments("Exit code of previously executed command")),
IgnoreRepos: flag.String(
"ignore-repos",
"",
"A list of git repos to ignore. Separate with ','\n"+
"Repos are identified by their root directory."),
comments("A list of git repos to ignore. Separate with ','",
"Repos are identified by their root directory.")),
ShortenGKENames: flag.Bool(
"shorten-gke-names",
false,
"Shortens names for GKE Kube clusters."),
comments("Shortens names for GKE Kube clusters.")),
}
flag.Parse()
if strings.HasSuffix(*args.Theme, ".json") {
Expand Down

0 comments on commit a4bb002

Please sign in to comment.