cmd

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BhojpurEnvPrefix = "BHOJPUR"
)

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "isomgr",
	Short: "Container based package manager",
	Long: `It is a single-binary package manager based on containers to build packages. 

For documentation, visit https://docs.bhojpur.net.
	
To install a package:

	$ isomgr install package

To search for a package in the repositories:

$ isomgr search package

To list all packages installed in the system:

	$ isomgr search --installed .

To show hidden packages:

	$ isomgr search --hidden package

To build a package, from a tree definition:

	$ isomgr build --tree tree/path package
	
`,
	Version: version(),
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		ctx, err := util.InitContext(cmd)
		if err != nil {
			fmt.Println("failed to load configuration:", err.Error())
			os.Exit(1)
		}

		util.DefaultContext = ctx

		util.DisplayVersionBanner(util.DefaultContext, version, license)

		viper.BindPFlag("plugin", cmd.Flags().Lookup("plugin"))

		plugin := viper.GetStringSlice("plugin")

		bus.Manager.Initialize(util.DefaultContext, plugin...)
		if len(bus.Manager.Plugins) != 0 {
			util.DefaultContext.Info(":lollipop:Enabled plugins:")
			for _, p := range bus.Manager.Plugins {
				util.DefaultContext.Info(fmt.Sprintf("\t:arrow_right: %s (at %s)", p.Name, p.Executable))
			}
		}
	},
	PersistentPostRun: func(cmd *cobra.Command, args []string) {

		err := util.DefaultContext.Clean()
		if err != nil {
			util.DefaultContext.Warning("failed on cleanup tmpdir:", err.Error())
		}
	},
	SilenceErrors: true,
}

RootCmd represents the base command when called without any subcommands

View Source
var Verbose bool

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func NewExistCommand

func NewExistCommand() *cobra.Command

func NewPackCommand

func NewPackCommand() *cobra.Command

func NewUnpackCommand

func NewUnpackCommand() *cobra.Command

Types

type PackageResult

type PackageResult struct {
	Name       string   `json:"name"`
	Category   string   `json:"category"`
	Version    string   `json:"version"`
	Repository string   `json:"repository"`
	Target     string   `json:"target"`
	Hidden     bool     `json:"hidden"`
	Files      []string `json:"files"`
	Installed  bool     `json:"installed"`
}

func (PackageResult) String

func (r PackageResult) String() string

type Results

type Results struct {
	Packages []PackageResult `json:"packages"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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