Skip to content

Commit

Permalink
Rename to cpm, fix some descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
trgeiger committed Apr 21, 2024
1 parent f6a941c commit f07b03d
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
copr-cli
copr-tool
cpm
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# copr-tool
# Copr Manager

CLI app for managing Copr repos, written in Go.

## Usage
`copr-tool [OPTION] [REPO(s)...]`
`cpm [OPTION] [REPO(s)...]`

```
Options:
Expand All @@ -20,8 +20,8 @@ Arguments:
[REPO(s)...] One or more repository names formatted as `author/repo`
Examples:
copr-tool enable kylegospo/bazzite yalter/niri
copr-tool disable kylegospo/bazzite
copr-tool remove kylegospo/bazzite
copr-tool list --all
cpm enable kylegospo/bazzite yalter/niri
cpm disable kylegospo/bazzite
cpm remove kylegospo/bazzite
cpm list --all
```
2 changes: 1 addition & 1 deletion cmd/disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/trgeiger/copr-tool/internal/app"
"github.com/trgeiger/cpm/internal/app"
)

func NewDisableCmd(fs afero.Fs, out io.Writer) *cobra.Command {
Expand Down
6 changes: 3 additions & 3 deletions cmd/disable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/trgeiger/copr-tool/internal/testutil"
"github.com/trgeiger/cpm/internal/testutil"
)

func TestDisableCmd(t *testing.T) {
Expand All @@ -18,9 +18,9 @@ func TestDisableCmd(t *testing.T) {
{
name: "Disable invalid repo name",
args: []string{
"copr-tool",
"cpm",
},
expected: "invalid repository name: copr-tool\n",
expected: "invalid repository name: cpm\n",
},
{
name: "Repo does not exist",
Expand Down
8 changes: 1 addition & 7 deletions cmd/enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/trgeiger/copr-tool/internal/app"
"github.com/trgeiger/cpm/internal/app"
)

func verifyCoprRepo(r *app.CoprRepo, fs afero.Fs) error {
Expand Down Expand Up @@ -62,12 +62,6 @@ func NewEnableCmd(fs afero.Fs, out io.Writer) *cobra.Command {
Aliases: []string{"add"},
Args: cobra.MinimumNArgs(1),
Short: "Enable or add one or more Copr repositories.",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
for _, arg := range args {
repo, err := app.NewCoprRepo(arg)
Expand Down
6 changes: 3 additions & 3 deletions cmd/enable_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/trgeiger/copr-tool/internal/testutil"
"github.com/trgeiger/cpm/internal/testutil"
)

func TestEnableCmd(t *testing.T) {
Expand All @@ -28,9 +28,9 @@ func TestEnableCmd(t *testing.T) {
{
name: "Add invalid repo name",
args: []string{
"copr-tool",
"cpm",
},
expected: "invalid repository name: copr-tool\n",
expected: "invalid repository name: cpm\n",
},
{
name: "Repo does not exist",
Expand Down
13 changes: 6 additions & 7 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/trgeiger/copr-tool/internal/app"
"github.com/trgeiger/cpm/internal/app"
)

var (
Expand Down Expand Up @@ -41,12 +41,11 @@ func NewListCmd(fs afero.Fs, out io.Writer) *cobra.Command {
cmd := &cobra.Command{
Use: "list",
Short: "List installed Copr repositories",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Long: `List all installed and enabled Copr repositories by default.
For example:
cpm list
cpm list --all
cpm list --disabled`,
Run: func(cmd *cobra.Command, args []string) {
var lists []app.RepoState
if !disabled {
Expand Down
2 changes: 1 addition & 1 deletion cmd/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/trgeiger/copr-tool/internal/testutil"
"github.com/trgeiger/cpm/internal/testutil"
)

func TestListCmd(t *testing.T) {
Expand Down
1 change: 1 addition & 0 deletions cmd/prune.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewPruneCmd(fs afero.Fs, out io.Writer) *cobra.Command {
return &cobra.Command{
Use: "prune",
Short: "Remove duplicate repository configurations.",
Long: "Cleans Copr repository configuration files by removing duplicates and renaming the remaining files to standard format.",
Run: func(cmd *cobra.Command, args []string) {
repos, err := app.GetReposList(fs, out, app.Enabled)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/prune_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/trgeiger/copr-tool/internal/testutil"
"github.com/trgeiger/cpm/internal/testutil"
)

func TestPruneCmd(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

"github.com/spf13/afero"
"github.com/spf13/cobra"
"github.com/trgeiger/copr-tool/internal/app"
"github.com/trgeiger/cpm/internal/app"
)

func NewRemoveCmd(fs afero.Fs, out io.Writer) *cobra.Command {
Expand Down
6 changes: 3 additions & 3 deletions cmd/remove_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"bytes"
"testing"

"github.com/trgeiger/copr-tool/internal/testutil"
"github.com/trgeiger/cpm/internal/testutil"
)

func TestRemoveCmd(t *testing.T) {
Expand All @@ -18,9 +18,9 @@ func TestRemoveCmd(t *testing.T) {
{
name: "Remove invalid repo name",
args: []string{
"copr-tool",
"cpm",
},
expected: "invalid repository name: copr-tool\n",
expected: "invalid repository name: cpm\n",
},
{
name: "Remove uninstalled repo",
Expand Down
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func Execute(fs afero.Fs) {
viper.SetFs(fs)
if err := viper.ReadInConfig(); err != nil {
if _, ok := err.(viper.ConfigFileNotFoundError); ok {
panic(fmt.Errorf("could not find /etc/os-release, copr-tool only functions on Fedora Linux systems: %w", err))
panic(fmt.Errorf("could not find /etc/os-release, cpm only functions on Fedora Linux systems: %w", err))

} else {
panic(fmt.Errorf("unknown fatal error: %w", err))
Expand All @@ -50,8 +50,8 @@ func Execute(fs afero.Fs) {
func NewRootCmd(fs afero.Fs, out io.Writer) (*cobra.Command, error) {

cmd := &cobra.Command{
Use: "copr-tool",
Short: "A command line tool for managing Copr repositories",
Use: "cpm",
Short: "Copr Manager: a command line tool for managing Copr repositories",
}

cmd.AddCommand(
Expand All @@ -71,7 +71,7 @@ func init() {
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.

// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.copr-tool.yaml)")
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.cpm.yaml)")

// Cobra also supports local flags, which will only run
// when this action is called directly.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/trgeiger/copr-tool
module github.com/trgeiger/cpm

go 1.22.2

Expand Down
2 changes: 1 addition & 1 deletion internal/testutil/test-utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package testutil

import (
"github.com/spf13/afero"
"github.com/trgeiger/copr-tool/internal/app"
"github.com/trgeiger/cpm/internal/app"
)

func AssembleTestFs(repoFiles [][]string, otherFiles [][]string) afero.Fs {
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package main

import (
"github.com/spf13/afero"
"github.com/trgeiger/copr-tool/cmd"
"github.com/trgeiger/cpm/cmd"
)

func main() {
Expand Down

0 comments on commit f07b03d

Please sign in to comment.