Skip to content

Commit 491fe33

Browse files
committed
Disable notice on --short
Fixes #657 Signed-off-by: Nelo-T. Wallus <[email protected]>
1 parent 7814220 commit 491fe33

File tree

1 file changed

+8
-6
lines changed
  • cli/pkg/workspace/plugin

1 file changed

+8
-6
lines changed

cli/pkg/workspace/plugin/use.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,19 @@ func (o *UseWorkspaceOptions) Run(ctx context.Context) (err error) {
127127
name = "~" + strings.TrimPrefix(name, home)
128128
}
129129
name = strings.ReplaceAll(name, "/", ":")
130-
if name == core.RootCluster.String() || strings.HasPrefix(name, core.RootCluster.String()+":") {
130+
if name == core.RootCluster.String() || strings.HasPrefix(name, core.RootCluster.String()+":") && !o.ShortWorkspaceOutput {
131131
// LEGACY(mjudeikis): Remove once everybody gets used to this
132132
name = ":" + name
133133
fmt.Fprintf(o.ErrOut, "Note: Using 'root:' to define an absolute path is no longer supported. Instead, use ':root' to specify an absolute path.\n")
134134
}
135135
if name == "" {
136-
defer func() {
137-
if err == nil {
138-
_, err = fmt.Fprintf(o.ErrOut, "Note: 'kubectl ws' now matches 'cd' semantics: go to home workspace. 'kubectl ws -' to go back. 'kubectl ws .' to print current workspace.\n")
139-
}
140-
}()
136+
if !o.ShortWorkspaceOutput {
137+
defer func() {
138+
if err == nil {
139+
_, err = fmt.Fprintf(o.ErrOut, "Note: 'kubectl ws' now matches 'cd' semantics: go to home workspace. 'kubectl ws -' to go back. 'kubectl ws .' to print current workspace.\n")
140+
}
141+
}()
142+
}
141143
name = "~"
142144
}
143145

0 commit comments

Comments
 (0)