mirror of
https://github.com/goreleaser/nfpm
synced 2024-05-23 04:56:27 +02:00
a18661b627
* feat: add support for Arch Linux packages * test: Add initial tests * test: Increase coverage by modifying example info * test: Add test for ArchLinux.ConventionalFileName() * docs: Return error if package name is invalid * fix: Make empty name invalid * fix: Add replaces field to .PKGINFO generator * test: Add additional tests * test: Test for added replaces field * docs: Add more comments * style: Run gofumpt * fix: Handle errors as recommended by linter * fix: Allow changing the pkgbase * style: Resolve semgrep findings * docs: Change docs to reflect new Arch Linux packager * docs: Fix spelling mistake in comment Co-authored-by: Dj Gilcrease <digitalxero@gmail.com> * docs: use aspell to fix all spelling mistakes * feat: Handle packaging formats with non-distinct file extensions as described in #546 * fix: Add newline to generated .INSTALL file * fix: Take into account provided info for non-symlink files * docs: Fix names for arch-specific scripts in documentation * fix: Only consider files with the correct packager field * fix: Use correct scripts field for post_remove script * test: Implement archlinux acceptance tests * test: Add archlinux to acceptance_test.go * test: Add archlinux to github test matrix * test: Use updated build.yml from main branch * Fix ConventionalExtension() for apk * fix: Take epoch value into account * fix: Add arm5 and arm6 architectures Co-authored-by: Dj Gilcrease <digitalxero@gmail.com> Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
56 lines
1.1 KiB
Go
56 lines
1.1 KiB
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
_ "github.com/goreleaser/nfpm/v2/apk"
|
|
_ "github.com/goreleaser/nfpm/v2/arch"
|
|
_ "github.com/goreleaser/nfpm/v2/deb"
|
|
_ "github.com/goreleaser/nfpm/v2/rpm"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func Execute(version string, exit func(int), args []string) {
|
|
newRootCmd(version, exit).Execute(args)
|
|
}
|
|
|
|
type rootCmd struct {
|
|
cmd *cobra.Command
|
|
exit func(int)
|
|
}
|
|
|
|
func (cmd *rootCmd) Execute(args []string) {
|
|
cmd.cmd.SetArgs(args)
|
|
|
|
if err := cmd.cmd.Execute(); err != nil {
|
|
fmt.Println(err.Error())
|
|
cmd.exit(1)
|
|
}
|
|
}
|
|
|
|
func newRootCmd(version string, exit func(int)) *rootCmd {
|
|
root := &rootCmd{
|
|
exit: exit,
|
|
}
|
|
cmd := &cobra.Command{
|
|
Use: "nfpm",
|
|
Short: "Packages apps on RPM, Deb and APK formats based on a YAML configuration file",
|
|
Long: `nFPM is a simple, 0-dependencies, deb, rpm and apk packager.`,
|
|
Version: version,
|
|
SilenceUsage: true,
|
|
SilenceErrors: true,
|
|
Args: cobra.NoArgs,
|
|
}
|
|
|
|
cmd.AddCommand(
|
|
newInitCmd().cmd,
|
|
newPackageCmd().cmd,
|
|
newDocsCmd().cmd,
|
|
newManCmd().cmd,
|
|
newSchemaCmd().cmd,
|
|
)
|
|
|
|
root.cmd = cmd
|
|
return root
|
|
}
|