mirror of https://github.com/docker/docs.git
Merge pull request #3405 from eedeebee/3404-add-tcsh-support-to-env-command
Add tcsh support to --shell
This commit is contained in:
commit
52d0020542
|
|
@ -237,7 +237,7 @@ var Commands = []cli.Command{
|
||||||
},
|
},
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "shell",
|
Name: "shell",
|
||||||
Usage: "Force environment to be configured for a specified shell: [fish, cmd, powershell], default is auto-detect",
|
Usage: "Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh], default is auto-detect",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
cli.BoolFlag{
|
||||||
Name: "unset, u",
|
Name: "unset, u",
|
||||||
|
|
|
||||||
|
|
@ -134,6 +134,10 @@ func shellCfgSet(c CommandLine, api libmachine.API) (*ShellConfig, error) {
|
||||||
shellCfg.Prefix = "SET "
|
shellCfg.Prefix = "SET "
|
||||||
shellCfg.Suffix = "\n"
|
shellCfg.Suffix = "\n"
|
||||||
shellCfg.Delimiter = "="
|
shellCfg.Delimiter = "="
|
||||||
|
case "tcsh":
|
||||||
|
shellCfg.Prefix = "setenv "
|
||||||
|
shellCfg.Suffix = "\";\n"
|
||||||
|
shellCfg.Delimiter = " \""
|
||||||
case "emacs":
|
case "emacs":
|
||||||
shellCfg.Prefix = "(setenv \""
|
shellCfg.Prefix = "(setenv \""
|
||||||
shellCfg.Suffix = "\")\n"
|
shellCfg.Suffix = "\")\n"
|
||||||
|
|
@ -182,6 +186,10 @@ func shellCfgUnset(c CommandLine, api libmachine.API) (*ShellConfig, error) {
|
||||||
shellCfg.Prefix = "(setenv \""
|
shellCfg.Prefix = "(setenv \""
|
||||||
shellCfg.Suffix = ")\n"
|
shellCfg.Suffix = ")\n"
|
||||||
shellCfg.Delimiter = "\" nil"
|
shellCfg.Delimiter = "\" nil"
|
||||||
|
case "tcsh":
|
||||||
|
shellCfg.Prefix = "unsetenv "
|
||||||
|
shellCfg.Suffix = ";\n"
|
||||||
|
shellCfg.Delimiter = ""
|
||||||
default:
|
default:
|
||||||
shellCfg.Prefix = "unset "
|
shellCfg.Prefix = "unset "
|
||||||
shellCfg.Suffix = "\n"
|
shellCfg.Suffix = "\n"
|
||||||
|
|
@ -249,6 +257,9 @@ func (g *EnvUsageHintGenerator) GenerateUsageHint(userShell string, args []strin
|
||||||
case "emacs":
|
case "emacs":
|
||||||
cmd = fmt.Sprintf("(with-temp-buffer (shell-command \"%s\" (current-buffer)) (eval-buffer))", commandLine)
|
cmd = fmt.Sprintf("(with-temp-buffer (shell-command \"%s\" (current-buffer)) (eval-buffer))", commandLine)
|
||||||
comment = ";;"
|
comment = ";;"
|
||||||
|
case "tcsh":
|
||||||
|
cmd = fmt.Sprintf("eval `%s`", commandLine)
|
||||||
|
comment = ":"
|
||||||
default:
|
default:
|
||||||
cmd = fmt.Sprintf("eval $(%s)", commandLine)
|
cmd = fmt.Sprintf("eval $(%s)", commandLine)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,12 @@ func TestHints(t *testing.T) {
|
||||||
{"emacs", []string{"./machine", "env", "--shell=emacs", "--swarm", "default"}, ";; Run this command to configure your shell: \n;; (with-temp-buffer (shell-command \"./machine env --shell=emacs --swarm default\" (current-buffer)) (eval-buffer))\n"},
|
{"emacs", []string{"./machine", "env", "--shell=emacs", "--swarm", "default"}, ";; Run this command to configure your shell: \n;; (with-temp-buffer (shell-command \"./machine env --shell=emacs --swarm default\" (current-buffer)) (eval-buffer))\n"},
|
||||||
{"emacs", []string{"./machine", "env", "--shell=emacs", "--no-proxy", "--swarm", "default"}, ";; Run this command to configure your shell: \n;; (with-temp-buffer (shell-command \"./machine env --shell=emacs --no-proxy --swarm default\" (current-buffer)) (eval-buffer))\n"},
|
{"emacs", []string{"./machine", "env", "--shell=emacs", "--no-proxy", "--swarm", "default"}, ";; Run this command to configure your shell: \n;; (with-temp-buffer (shell-command \"./machine env --shell=emacs --no-proxy --swarm default\" (current-buffer)) (eval-buffer))\n"},
|
||||||
{"emacs", []string{"./machine", "env", "--shell=emacs", "--unset"}, ";; Run this command to configure your shell: \n;; (with-temp-buffer (shell-command \"./machine env --shell=emacs --unset\" (current-buffer)) (eval-buffer))\n"},
|
{"emacs", []string{"./machine", "env", "--shell=emacs", "--unset"}, ";; Run this command to configure your shell: \n;; (with-temp-buffer (shell-command \"./machine env --shell=emacs --unset\" (current-buffer)) (eval-buffer))\n"},
|
||||||
|
|
||||||
|
{"tcsh", []string{"./machine", "env", "--shell=tcsh", "default"}, ": Run this command to configure your shell: \n: eval `./machine env --shell=tcsh default`\n"},
|
||||||
|
{"tcsh", []string{"./machine", "env", "--shell=tcsh", "--no-proxy", "default"}, ": Run this command to configure your shell: \n: eval `./machine env --shell=tcsh --no-proxy default`\n"},
|
||||||
|
{"tcsh", []string{"./machine", "env", "--shell=tcsh", "--swarm", "default"}, ": Run this command to configure your shell: \n: eval `./machine env --shell=tcsh --swarm default`\n"},
|
||||||
|
{"tcsh", []string{"./machine", "env", "--shell=tcsh", "--no-proxy", "--swarm", "default"}, ": Run this command to configure your shell: \n: eval `./machine env --shell=tcsh --no-proxy --swarm default`\n"},
|
||||||
|
{"tcsh", []string{"./machine", "env", "--shell=tcsh", "--unset"}, ": Run this command to configure your shell: \n: eval `./machine env --shell=tcsh --unset`\n"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ a particular machine.
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
--swarm Display the Swarm config instead of the Docker daemon
|
--swarm Display the Swarm config instead of the Docker daemon
|
||||||
--shell Force environment to be configured for a specified shell: [fish, cmd, powershell], default is sh/bash
|
--shell Force environment to be configured for a specified shell: [fish, cmd, powershell, tcsh], default is sh/bash
|
||||||
--unset, -u Unset variables instead of setting them
|
--unset, -u Unset variables instead of setting them
|
||||||
--no-proxy Add machine IP to NO_PROXY environment variable
|
--no-proxy Add machine IP to NO_PROXY environment variable
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue