cli

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCopyCmd

func CreateCopyCmd(repos repository.Repos) *cobra.Command
Example
fsmock := repository.FsMockRepository{
	Files: []string{
		"/workdir/a.txt",
	},
}
repos := repository.NewMock(&fsmock)

copyCmd := CreateCopyCmd(repos)
copyCmd.SetArgs([]string{"a.txt"})
copyCmd.Execute()
Output:

copied: a.txt
Example (MultipleFiles)
fsmock := repository.FsMockRepository{
	Files: []string{
		"/workdir/a.txt",
		"/workdir/b.txt",
		"/workdir/c.txt",
	},
}
repos := repository.NewMock(&fsmock)

copyCmd := CreateCopyCmd(repos)
copyCmd.SetArgs([]string{"."})
copyCmd.Execute()
Output:

copied: a.txt
copied: b.txt
copied: c.txt
Example (UseWildCard)
fsmock := repository.FsMockRepository{
	Files: []string{
		"/workdir/a.txt",
		"/workdir/ab.txt",
		"/workdir/abc.txt",
		"/workdir/abcd.txt",
		"/workdir/bc.txt",
		"/workdir/ab",
		"/workdir/ab/aa.txt",
		"/workdir/abc",
		"/workdir/abc/aa.txt",
	},
}
repos := repository.NewMock(&fsmock)

copyCmd := CreateCopyCmd(repos)
copyCmd.SetArgs([]string{"ab*"})
copyCmd.Execute()
Output:

copied: ab
copied: ab.txt
copied: ab/aa.txt
copied: abc
copied: abc.txt
copied: abc/aa.txt
copied: abcd.txt

func CreateListCmd

func CreateListCmd(repos repository.Repos) *cobra.Command
Example
fsmock := repository.FsMockRepository{
	Files: []string{
		"/.cpbuf",
		"/.cpbuf/a.txt",
		"/.cpbuf/b.txt",
		"/.cpbuf/c.txt",
	},
}
repos := repository.NewMock(&fsmock)

listCmd := CreateListCmd(repos)
listCmd.Execute()
Output:

a.txt
b.txt
c.txt

func CreatePasteCmd

func CreatePasteCmd(repos repository.Repos) *cobra.Command
Example
fsmock := repository.FsMockRepository{
	Files: []string{
		"/.cpbuf",
		"/.cpbuf/a.txt",
		"/workdir/b.txt",
	},
}
repos := repository.NewMock(&fsmock)

pasteCmd := CreatePasteCmd(repos)
pasteCmd.Execute()
Output:

pasted: a.txt

func CreateResetCmd

func CreateResetCmd(repos repository.Repos) *cobra.Command

Types

This section is empty.

Jump to

Keyboard shortcuts

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