sync

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Run = &cli.Command{
	Name:  global.CmdSync,
	Usage: "sync gitbook",
	Flags: []cli.Flag{
		&cli.StringFlag{
			Name:  "source",
			Usage: "gitbook数据源(包含node_modules)",
			Value: "https://github.com/gofulljs/gitbook/releases/download/3.2.3/3.2.3.tar.gz",
		},
		&cli.StringFlag{
			Name:  "proxy1",
			Usage: fmt.Sprintf("自定义加速源(前缀+source), 不传采用以下\n%v", global.Proxy1s),
		},
		&cli.StringFlag{
			Name:  "proxy2",
			Usage: `自定义加速源(替换https://github.com前缀)`,
		},
	},
	Action: func(cctx *cli.Context) error {
		bookVersion := cctx.String("bookVersion")

		var err error
		bookHome := cctx.String("bookHome")
		if bookHome == "" {
			bookHome, err = getRootPath()
			if err != nil {
				return err
			}
		}

		bookVersionPath := filepath.Join(bookHome, bookVersion)

		if checkGitbookIsExist(bookVersionPath) {
			return nil
		}

		return MustDownloadGitbook(bookHome, cctx.String("proxy1"), cctx.String("proxy2"), cctx.String("source"))
	},
}

Functions

func MustDownloadGitbook

func MustDownloadGitbook(rootPath, proxy1, proxy2, sourceURI string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL