X Tutup
Skip to content

Commit 025f86b

Browse files
committed
init commit
1 parent 93cea6d commit 025f86b

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

pkg/cmd/repo/delete/delete.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package delete
2+
3+
import (
4+
"net/http"
5+
6+
"github.com/cli/cli/v2/pkg/cmdutil"
7+
8+
"github.com/cli/cli/v2/pkg/iostreams"
9+
"github.com/spf13/cobra"
10+
)
11+
12+
type DeleteOptions struct {
13+
HttpClient func() (*http.Client, error)
14+
IO *iostreams.IOStreams
15+
RepoArg string
16+
Confirmed bool
17+
}
18+
19+
func NewCmdDelete(f *cmdutil.Factory, runF func(*DeleteOptions) error) *cobra.Command {
20+
opts := &DeleteOptions{
21+
IO: f.IOStreams,
22+
HttpClient: f.HttpClient,
23+
}
24+
25+
cmd := &cobra.Command{
26+
Use: "delete <repository>",
27+
Short: "Delete a repository",
28+
Long: `Delete a GitHub repository.
29+
30+
Ensure that you have authorized the \"delete_repo\" scope: gh auth refresh -h github.com -s delete_repo"`,
31+
Args: cmdutil.ExactArgs(1, "cannot delete: repository argument required"),
32+
RunE: func(cmd *cobra.Command, args []string) error {
33+
opts.RepoArg = args[0]
34+
if runF != nil {
35+
return runF(opts)
36+
}
37+
return deleteRun(opts)
38+
},
39+
}
40+
41+
cmd.Flags().BoolVar(&opts.Confirmed, "yes", false, "Confirm deletion without prompting")
42+
return cmd
43+
}
44+
45+
func deleteRun(opts *DeleteOptions) error {
46+
47+
return nil
48+
}

pkg/cmd/repo/delete/http.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package delete
2+
3+
import (
4+
"net/http"
5+
)
6+
7+
func deleteRepo(client *http.Client) error {
8+
9+
}

0 commit comments

Comments
 (0)
X Tutup