Documentation
¶
Overview ¶
Copyright © 2025 NAME HERE <EMAIL ADDRESS>
Copyright © 2024 Rohan Date <rohan.s.date@icloud.com>
Copyright © 2024 Rohan Date <rohan.s.date@icloud.com>
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var BuildCmd = &cobra.Command{ Use: "build", Short: "Builds the package in the project path specified", Long: `Builds the package in the project path specified. For example: if you have a project in /home/user/MyProject, you can build it by running rpkg build /home/user/MyProject`, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { fmt.Println("Your package is being built at " + args[0] + ". Would you like to continue? [Y/n]") fmt.Scan(&input) if input == "Y" { if _, err := buildPackage(args[0]); err != nil { fmt.Println("Build failed.") os.Exit(1) } else { fmt.Println("Build successful.") os.Exit(0) } } else { fmt.Println("Build aborted.") os.Exit(0) } }, }
buildCmd represents the build command
View Source
var InstallCmd = &cobra.Command{ Use: "install", Short: "Installs a package from the environment variable RPKG_MIRROR", Long: `Install installs a package from the environment variable RPKG_MIRROR. For example: rpkg install mypackage 1.0.0 will install mypackage version 1.0.0 from https://RPKG_MIRROR/projects/mypackage-1.0.0.tar.gz`, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { downloadPath := os.Getenv(download_dir) + "/" + args[0] + "-" + args[1] + ".tar.gz" projectPath := args[0] + "-" + args[1] + ".tar.gz" defaultMirror := os.Getenv(mirror) if defaultMirror == "" { fmt.Fprintln(os.Stdout, []any{"warning: environment variable RPKG_MIRROR not set.\nReverting to default mirror..."}...) code, err := DownloadPackage(downloadPath, "https://rsdate.github.io/projects/"+projectPath) if code != 0 && err != nil { panic(fmt.Errorf("fatal: Unable to download package. Please check to see whether your package actually exists. Error Message: %s", err)) } } else { fullName := "https://" + defaultMirror + "/projects/" + projectPath fmt.Fprintf(os.Stdout, "The package path on the mirror is %s and it will download to %s.\nWould you like to proceed with the installation? [Y or n]", []any{projectPath, downloadPath}...) fmt.Scan(&conf) if conf == "Y" { code, err := DownloadPackage(downloadPath, fullName) if code != 0 && err != nil { panic(fmt.Errorf("fatal: Unable to download package. Please check to see whether your package actually exists. Error Message: %s", err)) } fmt.Println("Installation completed! 🎉") } else if conf == "n" { fmt.Fprintln(os.Stdout, []any{"Installation aborted."}...) os.Exit(0) } } }, }
InstallCmd represents the install command
View Source
var RemoveCmd = &cobra.Command{ Use: "remove", Short: "Removes a package from your local system", Long: ``, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
removeCmd represents the remove command
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.