Skip to content

Conversation

@SegFault42
Copy link

WIP add s3 command

Integrate minio package to scw

TODO:

  • Merge .scwrc and ~/.scw/config.json
  • Naming convention (mc to scw)

// VersionArgs are flags for the `RunVersion` function
type S3Args struct{}

// Version is the handler for 'scw version'

Choose a reason for hiding this comment

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

comment on exported function S3 should be of the form "S3 ..."

minio "github.com/minio/mc/cmd"
)

// VersionArgs are flags for the `RunVersion` function

Choose a reason for hiding this comment

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

comment on exported type S3Args should be of the form "S3Args ..." (with optional leading article)

// Version is the handler for 'scw version'
func S3(ctx CommandContext, args S3Args) error {
// remove "s3" from arg list
os.Args = append(os.Args[:1], os.Args[2:]...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think It's a good idea to overwrite os.Args, could not you use args ?

return "", err
}
return filepath.Join(path, ".scwrc"), nil
return filepath.Join(path, ".scw/config.json"), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Will break the legacy ?

Copy link
Contributor

Choose a reason for hiding this comment

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

It works when ~/.scw doesn't exist ?

Choose a reason for hiding this comment

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

Should probably also split the string into .scw and config.json too, instead of embedding the / in it. filepath.Join() will add the OS appropriate separator.

// mv file to new Path
err = os.Rename(oldConfigPath, newConfigPath)
if err != nil {
fmt.Errorf("%s\n", err)

Choose a reason for hiding this comment

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

error strings should not be capitalized or end with punctuation or a newline

if os.IsNotExist(err) {
return
}
fmt.Errorf("%s\n", err)

Choose a reason for hiding this comment

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

error strings should not be capitalized or end with punctuation or a newline

// Get old config Path
oldConfigPath, err := GetHomeDir()
if err != nil {
fmt.Errorf("%s\n", err)

Choose a reason for hiding this comment

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

error strings should not be capitalized or end with punctuation or a newline

Version string `json:"version"`
}

// migrate config from home to ~/.scw/

Choose a reason for hiding this comment

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

comment on exported function MigrateConfig should be of the form "MigrateConfig ..."

minio "github.com/minio/mc/cmd"
)

// VersionArgs are flags for the `RunVersion` function

Choose a reason for hiding this comment

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

comment on exported type S3Args should be of the form "S3Args ..." (with optional leading article)

@reversTeam
Copy link

See : #529

@reversTeam reversTeam closed this Apr 17, 2019
clement-gilbert pushed a commit to clement-gilbert/scaleway-cli that referenced this pull request Mar 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants