init commit

This commit is contained in:
meiji163 2021-10-06 12:49:06 -07:00
parent 93cea6d370
commit 025f86b911
2 changed files with 57 additions and 0 deletions

View file

@ -0,0 +1,48 @@
package delete
import (
"net/http"
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/spf13/cobra"
)
type DeleteOptions struct {
HttpClient func() (*http.Client, error)
IO *iostreams.IOStreams
RepoArg string
Confirmed bool
}
func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command {
opts := &DeleteOptions{
IO: f.IOStreams,
HttpClient: f.HttpClient,
}
cmd := &cobra.Command{
Use: "delete <repository>",
Short: "Delete a repository",
Long: `Delete a GitHub repository.
Ensure that you have authorized the \"delete_repo\" scope: gh auth refresh -h github.com -s delete_repo"`,
Args: cmdutil.ExactArgs(1, "cannot delete: repository argument required"),
RunE: func(cmd *cobra.Command, args []string) error {
opts.RepoArg = args[0]
if runF != nil {
return runF(opts)
}
return deleteRun(opts)
},
}
cmd.Flags().BoolVar(&opts.Confirmed, "yes", false, "Confirm deletion without prompting")
return cmd
}
func deleteRun(opts *DeleteOptions) error {
return nil
}

View file

@ -0,0 +1,9 @@
package delete
import (
"net/http"
)
func deleteRepo(client *http.Client) error {
}