M cmd/builds.go => cmd/builds.go +7 -7
@@ 1,8 1,8 @@
package cmd
import (
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/helpers/errorhelper"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 22,7 22,7 @@ Takes yml manifests as arguments.`,
Args: cobra.MinimumNArgs(1),
ValidArgsFunction: completeYamlFiles,
Run: func(cmd *cobra.Command, args []string) {
- err := api.BuildDeploy(args)
+ err := rest.BuildDeploy(args)
errorhelper.ExitError(err)
},
}
@@ 35,7 35,7 @@ Takes one job ID as argument.`,
Args: cobra.ExactArgs(1),
ValidArgsFunction: completeNoFiles,
Run: func(cmd *cobra.Command, args []string) {
- err := api.BuildResubmit(args)
+ err := rest.BuildResubmit(args)
errorhelper.ExitError(err)
},
}
@@ 48,7 48,7 @@ Takes one job ID as argument.`,
Args: cobra.ExactArgs(1),
ValidArgsFunction: completeNoFiles,
Run: func(cmd *cobra.Command, args []string) {
- err := api.BuildInformation(args)
+ err := rest.BuildInformation(args)
errorhelper.ExitError(err)
},
}
@@ 57,13 57,13 @@ func init() {
rootCmd.AddCommand(buildsCmd)
buildsCmd.AddCommand(deployCmd)
- deployCmd.PersistentFlags().StringVarP(&api.BuildNote, "note", "n", "", "Build note")
+ deployCmd.PersistentFlags().StringVarP(&rest.BuildNote, "note", "n", "", "Build note")
deployCmd.RegisterFlagCompletionFunc("note", completeNoFiles)
- deployCmd.PersistentFlags().StringSliceVarP(&api.BuildTags, "tags", "t", nil, "Comma seperated string of tags")
+ deployCmd.PersistentFlags().StringSliceVarP(&rest.BuildTags, "tags", "t", nil, "Comma seperated string of tags")
deployCmd.RegisterFlagCompletionFunc("tags", completeNoFiles)
buildsCmd.AddCommand(resubmitCmd)
- resubmitCmd.PersistentFlags().BoolVarP(&api.BuildEdit, "edit", "e", false, "Edit manifest")
+ resubmitCmd.PersistentFlags().BoolVarP(&rest.BuildEdit, "edit", "e", false, "Edit manifest")
buildsCmd.AddCommand(infoCmd)
}
M cmd/git.go => cmd/git.go +4 -4
@@ 1,8 1,8 @@
package cmd
import (
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/helpers/errorhelper"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 18,17 18,17 @@ var artifactsCmd = &cobra.Command{
Short: "Upload artifact(s) to a ref",
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
- err := api.ArtifactsUpload(args)
+ err := rest.ArtifactsUpload(args)
errorhelper.ExitError(err)
},
}
func init() {
rootCmd.AddCommand(gitCmd)
- gitCmd.PersistentFlags().StringVarP(&api.RepoName, "repo", "r", "", "Repository name")
+ gitCmd.PersistentFlags().StringVarP(&rest.RepoName, "repo", "r", "", "Repository name")
gitCmd.RegisterFlagCompletionFunc("repo", completeNoFiles)
gitCmd.AddCommand(artifactsCmd)
- artifactsCmd.Flags().StringVar(&api.RefName, "ref", "", "Ref name")
+ artifactsCmd.Flags().StringVar(&rest.RefName, "ref", "", "Ref name")
artifactsCmd.RegisterFlagCompletionFunc("ref", completeNoFiles)
}
M cmd/lists.go => cmd/lists.go +5 -5
@@ 1,8 1,8 @@
package cmd
import (
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/helpers/errorhelper"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 25,7 25,7 @@ var patchListCmd = &cobra.Command{
Use: "list",
Short: "List patchsets",
Run: func(cmd *cobra.Command, args []string) {
- err := api.PrintPatchsets(args)
+ err := rest.PrintPatchsets(args)
errorhelper.ExitError(err)
},
}
@@ 36,14 36,14 @@ func init() {
listsCmd.AddCommand(patchCmd)
patchCmd.AddCommand(patchListCmd)
- patchListCmd.Flags().StringVarP(&api.ListName, "list", "l", "", "List name")
+ patchListCmd.Flags().StringVarP(&rest.ListName, "list", "l", "", "List name")
patchListCmd.RegisterFlagCompletionFunc("list", completeNoFiles)
- patchListCmd.Flags().StringVarP(&api.PatchStatus, "status", "s", "proposed", "Patchset status")
+ patchListCmd.Flags().StringVarP(&rest.PatchStatus, "status", "s", "proposed", "Patchset status")
patchListCmd.RegisterFlagCompletionFunc("status", func(cmd *cobra.Command, args []string, toComplete string) (
[]string, cobra.ShellCompDirective) {
return []string{"proposed", "needs_revision", "superseded", "approved", "rejected", "applied", "all"},
cobra.ShellCompDirectiveNoFileComp
})
- patchListCmd.Flags().StringVarP(&api.PatchPrefix, "prefix", "p", "", "Patchset prefix")
+ patchListCmd.Flags().StringVarP(&rest.PatchPrefix, "prefix", "p", "", "Patchset prefix")
patchListCmd.RegisterFlagCompletionFunc("prefix", completeNoFiles)
}
M cmd/meta.go => cmd/meta.go +4 -4
@@ 1,8 1,8 @@
package cmd
import (
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/helpers/errorhelper"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 18,7 18,7 @@ var profileCmd = &cobra.Command{
Short: "Get profile information",
Args: cobra.MaximumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
- err := api.MetaGetProfile()
+ err := rest.MetaGetProfile()
errorhelper.ExitError(err)
},
}
@@ 27,7 27,7 @@ var logCmd = &cobra.Command{
Use: "logs",
Short: "Get audit logs",
Run: func(cmd *cobra.Command, args []string) {
- err := api.MetaGetLogs()
+ err := rest.MetaGetLogs()
errorhelper.ExitError((err))
},
}
@@ 36,7 36,7 @@ func init() {
rootCmd.AddCommand(metaCmd)
metaCmd.AddCommand(profileCmd)
- profileCmd.PersistentFlags().BoolVarP(&api.MetaEdit, "edit", "e", false, "Edit profile information")
+ profileCmd.PersistentFlags().BoolVarP(&rest.MetaEdit, "edit", "e", false, "Edit profile information")
metaCmd.AddCommand(logCmd)
}
M cmd/paste.go => cmd/paste.go +7 -7
@@ 1,8 1,8 @@
package cmd
import (
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/helpers/errorhelper"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 19,7 19,7 @@ var createCmd = &cobra.Command{
Long: `Create a new paste resource.
Takes files as arguments.`,
Run: func(cmd *cobra.Command, args []string) {
- err := api.PasteCreate(args)
+ err := rest.PasteCreate(args)
errorhelper.ExitError(err)
},
}
@@ 31,7 31,7 @@ var deleteCmd = &cobra.Command{
Takes paste SHA hashes as arguments`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
- err := api.PasteDelete(args)
+ err := rest.PasteDelete(args)
errorhelper.ExitError(err)
},
}
@@ 40,7 40,7 @@ var cleanupCmd = &cobra.Command{
Use: "cleanup",
Short: "Delete expired paste resources",
Run: func(cmd *cobra.Command, args []string) {
- err := api.PasteCleanup()
+ err := rest.PasteCleanup()
errorhelper.ExitError(err)
},
}
@@ 49,12 49,12 @@ func init() {
rootCmd.AddCommand(pasteCmd)
pasteCmd.AddCommand(createCmd)
- createCmd.PersistentFlags().StringVarP(&api.PasteName, "name", "n", "unnamed", "Paste name")
- createCmd.PersistentFlags().StringVarP(&api.PasteVisibility, "visibility", "v", "", "Paste visibility")
+ createCmd.PersistentFlags().StringVarP(&rest.PasteName, "name", "n", "unnamed", "Paste name")
+ createCmd.PersistentFlags().StringVarP(&rest.PasteVisibility, "visibility", "v", "", "Paste visibility")
createCmd.RegisterFlagCompletionFunc("visibility", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return []string{"public", "private", "unlisted"}, cobra.ShellCompDirectiveNoFileComp
})
- createCmd.PersistentFlags().StringVarP(&api.PasteExpiration, "expiration", "e", "", "Paste expiration in days")
+ createCmd.PersistentFlags().StringVarP(&rest.PasteExpiration, "expiration", "e", "", "Paste expiration in days")
createCmd.RegisterFlagCompletionFunc("expiration", completeNoFiles)
pasteCmd.AddCommand(deleteCmd)
M cmd/root.go => cmd/root.go +2 -2
@@ 4,8 4,8 @@ import (
"fmt"
"os"
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/config"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 29,5 29,5 @@ func init() {
rootCmd.PersistentFlags().StringVar(&config.ConfigPath, "config", "", "Path to config.ini")
- rootCmd.PersistentFlags().StringVarP(&api.UserName, "user", "u", "", "Sourcehut username")
+ rootCmd.PersistentFlags().StringVarP(&rest.UserName, "user", "u", "", "Sourcehut username")
}
M cmd/todo.go => cmd/todo.go +4 -4
@@ 1,8 1,8 @@
package cmd
import (
- "git.xenrox.net/~xenrox/srhtctl/api"
"git.xenrox.net/~xenrox/srhtctl/helpers/errorhelper"
+ "git.xenrox.net/~xenrox/srhtctl/rest"
"github.com/spf13/cobra"
)
@@ 24,7 24,7 @@ var ticketListCmd = &cobra.Command{
Use: "list",
Short: "List tickets",
Run: func(cmd *cobra.Command, args []string) {
- err := api.PrintTickets(args)
+ err := rest.PrintTickets(args)
errorhelper.ExitError(err)
},
}
@@ 35,12 35,12 @@ func init() {
todoCmd.AddCommand(ticketCmd)
ticketCmd.AddCommand(ticketListCmd)
- ticketListCmd.Flags().StringVarP(&api.TicketStatus, "status", "s", "reported", "Ticket status")
+ ticketListCmd.Flags().StringVarP(&rest.TicketStatus, "status", "s", "reported", "Ticket status")
ticketListCmd.RegisterFlagCompletionFunc("status", func(cmd *cobra.Command, args []string, toComplete string) (
[]string, cobra.ShellCompDirective) {
return []string{"reported", "confirmed", "in_progress", "pending", "resolved", "all"},
cobra.ShellCompDirectiveNoFileComp
})
- ticketListCmd.Flags().StringVarP(&api.TrackerName, "tracker", "t", "", "Tracker name")
+ ticketListCmd.Flags().StringVarP(&rest.TrackerName, "tracker", "t", "", "Tracker name")
ticketListCmd.RegisterFlagCompletionFunc("tracker", completeNoFiles)
}
R api/api.go => rest/api.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"bytes"
R api/builds.go => rest/builds.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"fmt"
R api/git.go => rest/git.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"fmt"
R api/lists.go => rest/lists.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"fmt"
R api/meta.go => rest/meta.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"fmt"
R api/paste.go => rest/paste.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"fmt"
R api/todo.go => rest/todo.go +1 -1
@@ 1,4 1,4 @@
-package api
+package rest
import (
"fmt"