Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
jaronnie committed Jan 27, 2022
1 parent c417907 commit 09c5dae
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
11 changes: 5 additions & 6 deletions cmd/account.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package cmd

import (
_ "embed"
"fmt"

"github.com/jaronnie/qiniu-cli/cmd/fs"
"github.com/spf13/cobra"
"io/ioutil"
)

var (
accountOver bool
)

//go:embed banner.txt
var welcome string

var (
Acc fs.Account
Expand All @@ -35,22 +32,24 @@ var accountCmd = &cobra.Command{
}

func Account(cmd *cobra.Command, params []string) {
// banner
file, _ := ioutil.ReadFile("./banner.txt")
ak := Acc.GetAccount().Ak
sk := Acc.GetAccount().Sk
bucket := Bm.GetBucket()
if len(params) == 0 {
if ak == "" || sk == "" || bucket == "" {
fmt.Println("please set your ak, sk, bucket in config file(default is ~/.qn.toml)")
} else {
fmt.Println(welcome)
fmt.Println(string(file))
fmt.Println("Reading from ~/.qn.toml")
fmt.Println("ak: ", ak)
fmt.Println("sk: ", sk)
fmt.Println("bucket: ", bucket)
}
} else if len(params) == 3 && accountOver {
Acc.InitAccount(params)
fmt.Println(welcome)
fmt.Println(string(file))
} else if len(params) == 3 && !accountOver {
fmt.Println("please use -w flags. For example, qn account -w ak sk bucket")
}
Expand Down
7 changes: 0 additions & 7 deletions cmd/banner.txt

This file was deleted.

0 comments on commit 09c5dae

Please sign in to comment.