Skip to content

Commit

Permalink
Adding mutate --workdir option to set the working directory (#1615)
Browse files Browse the repository at this point in the history
* Adding mutate --workdir option to set the working directory

* Regenerating the Markdown docs for crane-mutate

* Minor fix in the crane-mutate Markdown doc
  • Loading branch information
eglookz committed Mar 28, 2023
1 parent 54e3f49 commit 21ac1b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/crane/cmd/mutate.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
var newRef string
var newRepo string
var user string
var workdir string

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

// Set workdir.
if len(workdir) > 0 {
cfg.Config.WorkingDir = workdir
}

// Mutate and write image.
img, err = mutate.Config(img, cfg.Config)
if err != nil {
Expand Down Expand Up @@ -165,6 +171,7 @@ func NewCmdMutate(options *[]crane.Option) *cobra.Command {
mutateCmd.Flags().StringVarP(&outFile, "output", "o", "", "Path to new tarball of resulting image")
mutateCmd.Flags().StringSliceVar(&newLayers, "append", []string{}, "Path to tarball to append to image")
mutateCmd.Flags().StringVarP(&user, "user", "u", "", "New user to set")
mutateCmd.Flags().StringVarP(&workdir, "workdir", "w", "", "New working dir to set")
return mutateCmd
}

Expand Down
1 change: 1 addition & 0 deletions cmd/crane/doc/crane_mutate.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21ac1b2

Please sign in to comment.