Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/airdb/adb into dev
Browse files Browse the repository at this point in the history
* 'dev' of https://github.com/airdb/adb:
  add examples
  add doc
  update
  typo
  • Loading branch information
deancn committed Aug 31, 2020
2 parents 1c68fbd + 52cf494 commit e16808c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ var loginWithToken bool
func initLogin() {
rootCmd.AddCommand(loginCommand)

// hostSSHCmd.PersistentFlags().StringVarP(&sshFlags.IdentityFile,
// "identity_file", "i", "~/.adb/id_rsa", "identity file")
loginCommand.PersistentFlags().BoolVarP(&loginWithToken, "token", "t", false, "login with token")

// hostSSHCmd.PersistentFlags().StringVarP(&sshFlags.IdentityFile, "identity_file", "i", "~/.adb/id_rsa", "identity file")
}

func login() {
Expand Down
11 changes: 7 additions & 4 deletions cmd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ package cmd
import (
"fmt"

"github.com/airdb/adb/internal/adblib"

"github.com/airdb/sailor"
"github.com/aliyun/alibaba-cloud-sdk-go/services/alidns"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -74,10 +76,11 @@ func service() {
var servicesAddCmdMinArgs = 2

var servicesAddCmd = &cobra.Command{
Use: "add [service] [SRV record value]",
Short: "Add service",
Long: "Add service",
Args: cobra.MinimumNArgs(servicesAddCmdMinArgs),
Use: "add [service] [SRV record value]",
Short: "Add service",
Long: "Add service",
Example: adblib.DNSSrvDoc,
Args: cobra.MinimumNArgs(servicesAddCmdMinArgs),
Run: func(cmd *cobra.Command, args []string) {
addService(args)
},
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWX
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
github.com/airdb/sailor v1.1.2-0.20200802151610-a033b3f2a246 h1:5URmvEzDlQ5RoyiyUvrX5Ao5F7nlycdbUKoGuiVecjA=
github.com/airdb/sailor v1.1.2-0.20200802151610-a033b3f2a246/go.mod h1:Txr7LHYpg61npbaDGkfud/lRaOFEaAB1f0anzuglOmI=
github.com/airdb/sailor v1.4.0-85dfa77 h1:ieXE0OhZKknCUZU3vi2bcYoWLt3BAiFDKosBTHH35pI=
github.com/airdb/sailor v1.4.0-85dfa77/go.mod h1:Txr7LHYpg61npbaDGkfud/lRaOFEaAB1f0anzuglOmI=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/aliyun/alibaba-cloud-sdk-go v1.61.279 h1:y/fx2Tc2JCJ92exFGxtytxUOJfInHCNLuk/7Bbmbgz0=
Expand Down
16 changes: 16 additions & 0 deletions internal/adblib/dns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package adblib

import (
"github.com/MakeNowJust/heredoc"
)

var (
DNSSrvDoc = heredoc.Doc(`
$ adb srv add _sip._tcp "10 60 443 bigbox.airdb.red"
$ adb srv add _sip._tcp "10 20 443 smallbox1.airdb.blue"
$ adb srv add _sip._tcp "10 20 443 smallbox2.airdb.green"
$ adb srv add _sip._tcp "20 0 443 backup.airdb.black"
> Refer: https://zh.wikipedia.org/wiki/SRV记录
`)
)
4 changes: 3 additions & 1 deletion internal/adblib/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ func LoginWithToken() {

bar.NewOption(0, 100)

var sleepInterval time.Duration = 100

for i := 0; i <= 100; i++ {
time.Sleep(100 * time.Millisecond)
time.Sleep(sleepInterval * time.Millisecond)
bar.Play(int64(i))
}

Expand Down
8 changes: 8 additions & 0 deletions internal/adblib/man.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@ $ Github or Git Command:
brew install github/gh/gh
gh --repo bbhj/lbs issue status
gh --repo bbhj/lbs issue view 1
5. Delete branch or tag
git branch -D dev
git push origin --delete dev
git tag -d v1.0
git push --delete origin v1.0
`)

OpenSSLDoc = heredoc.Doc(`
Expand Down
3 changes: 1 addition & 2 deletions internal/adblib/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
)

var TokenRequest = heredoc.Doc(`
https://sfc.baobeihuijia.com/release/oauth2/token?request_id=f572d396fae9206628714fb2ce00f72e94f2258f
https://scf.baobeihuijia.com/release/oauth2/token?request_id=f572d396fae9206628714fb2ce00f72e94f2258f
please login with Github, and wait for 30s after you login.
`)

0 comments on commit e16808c

Please sign in to comment.