Skip to content

[Refactor] Move the Config Struct from cmd/main.go to pkg/config#1793

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
Zheaoli:manjusaka/refactor-global-config
Jan 2, 2023
Merged

[Refactor] Move the Config Struct from cmd/main.go to pkg/config#1793
AkihiroSuda merged 1 commit into
containerd:mainfrom
Zheaoli:manjusaka/refactor-global-config

Conversation

@Zheaoli
Copy link
Copy Markdown
Member

@Zheaoli Zheaoli commented Jan 2, 2023

Most of the subcommand is related to this Config struct and global flags. like #1792

So I split it from the cmd package to let us can reuse the definition.

Signed-off-by: Zheao.Li me@manjusaka.me

Comment thread pkg/config/types/config.go
@AkihiroSuda AkihiroSuda added this to the v1.2.0 milestone Jan 2, 2023
@Zheaoli Zheaoli force-pushed the manjusaka/refactor-global-config branch from b80bc98 to 5f29e1a Compare January 2, 2023 18:21
@Zheaoli Zheaoli changed the title [Refactor] Move the Config Struct from cmd/main.go to pkg/config/types [Refactor] Move the Config Struct from cmd/main.go to pkg/config Jan 2, 2023
Comment thread pkg/api/types/global.go
@Zheaoli Zheaoli force-pushed the manjusaka/refactor-global-config branch from 5f29e1a to a3478f8 Compare January 2, 2023 18:24
Comment thread pkg/config/config.go Outdated
Signed-off-by: Zheao.Li <me@manjusaka.me>
@Zheaoli Zheaoli force-pushed the manjusaka/refactor-global-config branch from a3478f8 to 30b09eb Compare January 2, 2023 18:27
Copy link
Copy Markdown
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda merged commit 6e4ed3a into containerd:main Jan 2, 2023
@Zheaoli Zheaoli deleted the manjusaka/refactor-global-config branch January 2, 2023 18:49
Comment thread cmd/nerdctl/main.go

func initRootCmdFlags(rootCmd *cobra.Command, tomlPath string) (*pflag.FlagSet, error) {
cfg := NewConfig()
cfg := config.New()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to init GlobalCommandOptions here and then pass it to config.New()

cfg := GlobalCommandOptions{...}
config.New(cfg)

to keep the code semantic.
Cc @Zheaoli

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants