storj/cmd/uplink/main.go
Michal Niewrzal 36db00b2bf cmd/uplink: don't require setup or import if --access is set
We want to make using uplink as easy as possible. That's why we wan't to
avoid requiring setup or import command before normal usage if user
specified --access flag. If this flag is set then rest flags should be
set as defaults.

https://storjlabs.atlassian.net/browse/V3-3490

Change-Id: I95a7bd77a3f00b8d9981fee513e9e77aef298bca
2020-01-11 07:47:53 +00:00

23 lines
497 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"storj.io/storj/cmd/uplink/cmd"
"storj.io/storj/pkg/process"
)
func main() {
process.ExecWithCustomConfig(cmd.RootCmd, func(cmd *cobra.Command, vip *viper.Viper) error {
accessFlag := cmd.Flags().Lookup("access")
if accessFlag == nil || accessFlag.Value.String() == "" {
return process.LoadConfig(cmd, vip)
}
return nil
})
}