initrc

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitrcCmd = &cobra.Command{
	Use:   "initrc",
	Short: "init rc is command to invoke the activated bashrc",
	Run: func(cmd *cobra.Command, args []string) {

		fp := getCurrentExePath()

		reload_func := fmt.Sprintf(`
declare -f SSS_RELOAD > /dev/null && export SSS_LOADED=true || export SSS_LOADED=false
function SSS_RELOAD () {
	source <(%v load --reload=true)
}
if [[ "$SSS_LOADED" == "false" ]]; then
	source <(%v load)
fi
`, fp, fp)
		fmt.Println(reload_func)
	},
}
View Source
var InstallCmd = &cobra.Command{
	Use:   "install",
	Short: "output how to use this cli in rc files",
	Run: func(cmd *cobra.Command, args []string) {
		fp := getCurrentExePath()
		log.Infoln("using following command to add into zshrc:")
		log.Infof(`	echo 'source <(%v initrc)' >> ~/.zshrc `, fp)
		log.Infoln("using following command to add into bashrc:")
		log.Infof(`	echo 'source <(%v initrc)' >> ~/.bashrc `, fp)
	},
}
View Source
var LoadShellscriptsCmd = &cobra.Command{
	Use:   "load",
	Short: "load shell scripts",
	Run: func(cmd *cobra.Command, args []string) {

		if os.Getenv("SSS_LOADED") == "true" && !reload {

			return
		}
		cmd_impel.InitRC()
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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