Skip to content

Commit 21ac1b2

Browse files
authored
Adding mutate --workdir option to set the working directory (#1615)
* Adding mutate --workdir option to set the working directory * Regenerating the Markdown docs for crane-mutate * Minor fix in the crane-mutate Markdown doc
1 parent 54e3f49 commit 21ac1b2

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

cmd/crane/cmd/mutate.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
3737
var newRef string
3838
var newRepo string
3939
var user string
40+
var workdir string
4041

4142
mutateCmd := &cobra.Command{
4243
Use: "mutate",
@@ -114,6 +115,11 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
114115
cfg.Config.User = user
115116
}
116117

118+
// Set workdir.
119+
if len(workdir) > 0 {
120+
cfg.Config.WorkingDir = workdir
121+
}
122+
117123
// Mutate and write image.
118124
img, err = mutate.Config(img, cfg.Config)
119125
if err != nil {
@@ -165,6 +171,7 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
165171
mutateCmd.Flags().StringVarP(&outFile, "output", "o", "", "Path to new tarball of resulting image")
166172
mutateCmd.Flags().StringSliceVar(&newLayers, "append", []string{}, "Path to tarball to append to image")
167173
mutateCmd.Flags().StringVarP(&user, "user", "u", "", "New user to set")
174+
mutateCmd.Flags().StringVarP(&workdir, "workdir", "w", "", "New working dir to set")
168175
return mutateCmd
169176
}
170177

cmd/crane/doc/crane_mutate.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)