init commit
This commit is contained in:
parent
93cea6d370
commit
025f86b911
2 changed files with 57 additions and 0 deletions
48
pkg/cmd/repo/delete/delete.go
Normal file
48
pkg/cmd/repo/delete/delete.go
Normal 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
|
||||
}
|
||||
9
pkg/cmd/repo/delete/http.go
Normal file
9
pkg/cmd/repo/delete/http.go
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
package delete
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func deleteRepo(client *http.Client) error {
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue