app

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewCmdStart = &cobra.Command{
		Use:     "start",
		Aliases: []string{"."},
		Example: "tran sync start",
		Short:   "Start sync your tran config.",
		Run: func(cmd *cobra.Command, args []string) {
			if username != ":username" {
				exCmd := "echo '# My tran config - " + username + "\n\n## Clone\n\n```\ntran sync clone\n```\n\n**for more about sync command, run `tran sync -h`**' >> $HOME/.tran/README.md"

				gosh.Run(exCmd)
				gosh.RunMulti(constants.Start_ml(), constants.Start_w())
			} else {
				utils.AuthMessage()
			}
		},
	}

	NewCmdClone = &cobra.Command{
		Use:     "clone",
		Aliases: []string{"cn"},
		Short:   CloneHelp(),
		Run: func(cmd *cobra.Command, args []string) {
			if username != ":username" {
				gosh.RunMulti(constants.Clone_ml(), constants.Clone_w())
				gosh.RunMulti(constants.Clone_check_ml(), constants.Clone_check_w())
			} else {
				utils.AuthMessage()
			}
		},
	}

	NewCmdPush = &cobra.Command{
		Use:     "push",
		Aliases: []string{"ph"},
		Short:   "Push the new changes in tran config file.",
		Run: func(cmd *cobra.Command, args []string) {
			if username != ":username" {
				gosh.RunMulti(constants.Push_ml(), constants.Push_w())
			} else {
				utils.AuthMessage()
			}
		},
	}

	NewCmdPull = &cobra.Command{
		Use:     "pull",
		Aliases: []string{"pl"},
		Short:   PullHelp(),
		Run: func(cmd *cobra.Command, args []string) {
			if username != ":username" {
				gosh.RunMulti(constants.Pull_ml(), constants.Pull_w())
			} else {
				utils.AuthMessage()
			}
		},
	}

	FetchX = &cobra.Command{
		Use:   "fetchx",
		Short: "Special command for windows",
		Run: func(cmd *cobra.Command, args []string) {
			if username != ":username" {
				if runtime.GOOS == "windows" {
					gosh.PowershellCommand(constants.Clone_w())
				} else {
					fmt.Println("This command isn't avaliable for this platform")
				}
			} else {
				utils.AuthMessage()
			}
		},
	}
)
View Source
var NewAuthCmd = Auth(factory.New())
View Source
var NewGHConfigCmd = GHConfig(factory.New())
View Source
var NewGHRepoCmd = Repo(factory.New())
View Source
var NewReceiveCmd = &cobra.Command{
	Use:   "receive",
	Short: "Receive files/directories from remote",
	Long:  "Receive files/directories from remote",
	RunE: func(cmd *cobra.Command, args []string) error {
		err := tui.ValidateTranxAddress()

		if err != nil {
			return err
		}

		tui.HandleReceiveCommand(models.TranOptions{
			TranxAddress: constants.DEFAULT_ADDRESS,
			TranxPort:    constants.DEFAULT_PORT,
		}, args[0])

		return nil
	},
}
View Source
var NewSendCmd = &cobra.Command{
	Use:   "send",
	Short: "Send files/directories to remote",
	Long:  "Send files/directories to remote",
	RunE: func(cmd *cobra.Command, args []string) error {
		tools.RandomSeed()

		err := tui.ValidateTranxAddress()

		if err != nil {
			log.Fatal(err)
		}

		tui.HandleSendCommand(models.TranOptions{
			TranxAddress: constants.DEFAULT_ADDRESS,
			TranxPort:    constants.DEFAULT_PORT,
		}, args)

		return nil
	},
}

Functions

func Auth added in v0.1.1

func Auth(f *cmdutil.Factory) *cobra.Command

func CloneHelp added in v0.1.1

func CloneHelp() string

func GHConfig added in v0.1.1

func GHConfig(f *cmdutil.Factory) *cobra.Command

func PullHelp added in v0.1.1

func PullHelp() string

func PushSync added in v0.1.1

func PushSync()

func Repo added in v0.1.1

func Repo(f *cmdutil.Factory) *cobra.Command

func Sync added in v0.1.1

func Sync() *cobra.Command

func SyncHelp added in v0.1.1

func SyncHelp() string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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