Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddCmd = &cobra.Command{ Use: "add [<pack> | -f <packs list>]", Short: "Add Open-CMSIS-Pack packages", Long: ` Add a pack using the following "<pack>" specification or using packs provided by "-f <packs list>": $ cpackget add Vendor.Pack.1.2.3 $ cpackget add Vendor::Pack@1.2.3 Use the syntax above to let cpackget determine the location of pack files prior to installing it locally. $ cpackget add Vendor.Pack.1.2.3.pack Use this syntax if you already have a pack at hand and simply want to install it under pack-root folder. $ cpackget add path/to/Vendor.Pack.pdsc Use this syntax if you are installing a pack that has not been released yet. This will install it as a local pack and keep a reference in ".Local/local_repository.pidx". The file can be a local file or a file hosted somewhere else on the Internet. If it's hosted somewhere, cpackget will first download it then extract all pack files into "CMSIS_PACK_ROOT/<vendor>/<packName>/<x.y.z>/" If "-f" is used, cpackget will call "cpackget pack add" on each URL specified in the <packs list> file.`, Args: cobra.MinimumNArgs(0), PersistentPreRunE: configureInstaller, RunE: func(cmd *cobra.Command, args []string) error { if addCmdFlags.packsListFileName != "" { log.Infof("Parsing packs urls via file %v", addCmdFlags.packsListFileName) file, err := os.Open(addCmdFlags.packsListFileName) if err != nil { return err } defer file.Close() scanner := bufio.NewScanner(file) for scanner.Scan() { args = append(args, scanner.Text()) } if err := scanner.Err(); err != nil { return err } } if len(args) == 0 { log.Error("Missing a pack-path or list with pack urls specified via -f/--packs-list-filename") return errs.ErrIncorrectCmdArgs } log.Debugf("Specified packs %v", args) var lastErr error for _, packPath := range args { var err error if filepath.Ext(packPath) == ".pdsc" { err = installer.AddPdsc(packPath) } else { err = installer.AddPack(packPath, !addCmdFlags.skipEula, addCmdFlags.extractEula, addCmdFlags.forceReinstall) } if err != nil { lastErr = err if !errs.AlreadyLogged(err) { log.Error(err) } } } return lastErr }, }
View Source
var AllCommands = []*cobra.Command{ PackCmd, PdscCmd, IndexCmd, InitCmd, AddCmd, RmCmd, ListCmd, }
AllCommands contains all available commands for cpackget
View Source
var CopyRight string
View Source
var IndexCmd = &cobra.Command{ Use: "index <index url>", Short: "Updates public index", Long: `Updates the public index in CMSIS_PACK_ROOT/.Web/index.pidx using the file specified by the given url. If there's already an index file, cpackget won't overwrite it. Use "-f" to do so.`, PersistentPreRunE: configureInstaller, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { log.Infof("Updating index %v", args) indexPath := args[0] return installer.UpdatePublicIndex(indexPath, overwrite) }, }
View Source
var InitCmd = &cobra.Command{ Use: "init [--pack-root <pack root>] <index-url>", Short: "Initializes a pack root folder", Long: `Initializes a pack root folder specified by -R/--pack-root command line or via the CMSIS_PACK_ROOT environment variable with the following contents: - .Download/ - .Local/ - .Web/ - .Web/index.pidx (downloaded from <index-url>) The index-url is mandatory. Ex "cpackget init --pack-root path/to/mypackroot https://www.keil.com/pack/index.pidx"`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { packRoot := viper.GetString("pack-root") indexPath := args[0] log.Debugf("Initializing a new pack root in \"%v\" using index url \"%v\"", packRoot, indexPath) createPackRoot = true err := configureInstaller(cmd, args) if err != nil { return err } return installer.UpdatePublicIndex(indexPath, true) }, }
View Source
var ListCmd = &cobra.Command{ Use: "list [--cached|--public]", Short: "List installed packs", Long: `List all installed packs and optionally cached pack files`, Args: cobra.MaximumNArgs(0), PersistentPreRunE: configureInstaller, RunE: func(cmd *cobra.Command, args []string) error { return installer.ListInstalledPacks(listCmdFlags.listCached, listCmdFlags.listPublic) }, }
View Source
var PackCmd = &cobra.Command{
Deprecated: "Consider running `cpackget add|rm|list` instead",
Use: "pack",
Short: "Adds/Removes Open-CMSIS-Pack packages",
Long: "Adds/Removes Open-CMSIS-Pack packages from a local file or a file hosted somewhere else on the Internet.",
PersistentPreRunE: configureInstaller,
}
View Source
var PdscCmd = &cobra.Command{
Deprecated: "Consider running `cpackget add|rm|list` instead",
Use: "pdsc",
Short: "Adds or removes Open-CMSIS-Pack packages in the local file system via PDSC files.",
PersistentPreRunE: configureInstaller,
}
View Source
var RmCmd = &cobra.Command{ Use: "rm <pack reference>", Short: "Remove Open-CMSIS-Pack packages", Long: ` Remove a pack using the reference "Vendor.Pack[.x.y.z]", "Vendor::Pack[@x.y.z]" or "[path/to/]Vendor.Pack.pdsc". $ cpackget rm Vendor.Pack.1.2.3 $ cpackget rm Vendor::Pack@1.2.3 Use the syntax above to let cpackget determine the location of pack files prior to removing them. $ cpackget rm Vendor.LocalPackInstalledViaPdsc.pdsc $ cpackget rm path/to/Vendor.LocalPackInstalledViaPdsc.pdsc cpackget also identifies if the pack was installed via PDSC file. In this case, cpackget will remove its reference from ".Local/local_repository.pidx". In the first example, since just the basename of the PDSC file path was specified, cpackget will remove *ALL* references of the PDSC file it might find. Since it is possible to have many versions of the same pack installed via different PDSC file paths, one may wish to remove a specific one by specifying a more complete PDSC file path, as shown in the second example. The version "x.y.z" is optional. Cache files (i.e. under CMSIS_PACK_ROOT/.Download/) are *NOT* removed. If cache files need to be actually removed, please use "--purge".`, Args: cobra.MinimumNArgs(1), PersistentPreRunE: configureInstaller, RunE: func(cmd *cobra.Command, args []string) error { log.Infof("Removing %v", args) var lastErr error for _, packPath := range args { var err error if filepath.Ext(packPath) == ".pdsc" { err = installer.RemovePdsc(packPath) if err == errs.ErrPdscEntryNotFound { err = errs.ErrPackNotInstalled } } else { err = installer.RemovePack(packPath, rmCmdFlags.purge) } if err != nil { if err != errs.ErrAlreadyLogged { log.Error(err) err = errs.ErrAlreadyLogged } lastErr = err } } return lastErr }, }
View Source
var Version string
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.