MCPcopy Index your code
hub / github.com/rilldata/rill / EditCmd

Function EditCmd

cli/cmd/project/edit.go:11–122  ·  view source on GitHub ↗
(ch *cmdutil.Helper)

Source from the content-addressed store, hash-verified

9)
10
11func EditCmd(ch *cmdutil.Helper) *cobra.Command {
12 var name, description, primaryBranch, subpath, path, provisioner, gitRemote string
13 var public bool
14 var prodTTL, devTTL int64
15 var prodSlots, devSlots int
16
17 editCmd := &cobra.Command{
18 Use: "edit [<project-name>]",
19 Args: cobra.MaximumNArgs(1),
20 Short: "Edit the project details",
21 RunE: func(cmd *cobra.Command, args []string) error {
22 ctx := cmd.Context()
23 client, err := ch.Client()
24 if err != nil {
25 return fmt.Errorf("failed to initialize client: %w", err)
26 }
27
28 if len(args) > 0 {
29 name = args[0]
30 }
31
32 if name == "" {
33 return fmt.Errorf("pass project name as argument or with --project flag")
34 }
35
36 req := &adminv1.UpdateProjectRequest{
37 Org: ch.Org,
38 Project: name,
39 }
40
41 var flagSet bool
42 if cmd.Flags().Changed("provisioner") {
43 flagSet = true
44 req.Provisioner = &provisioner
45 }
46 if cmd.Flags().Changed("description") {
47 flagSet = true
48 req.Description = &description
49 }
50 if cmd.Flags().Changed("primary-branch") {
51 flagSet = true
52 req.PrimaryBranch = &primaryBranch
53 }
54 if cmd.Flags().Changed("subpath") {
55 flagSet = true
56 req.Subpath = &subpath
57 }
58 if cmd.Flags().Changed("public") {
59 flagSet = true
60 req.Public = &public
61 }
62 if cmd.Flags().Changed("prod-ttl-seconds") {
63 flagSet = true
64 req.ProdTtlSeconds = &prodTTL
65 }
66 if cmd.Flags().Changed("dev-ttl-seconds") {
67 flagSet = true
68 req.DevTtlSeconds = &devTTL

Callers 1

ProjectCmdFunction · 0.70

Calls 6

PrintfSuccessMethod · 0.80
PrintProjectsMethod · 0.80
ContextMethod · 0.65
ErrorfMethod · 0.65
UpdateProjectMethod · 0.65
ClientMethod · 0.45

Tested by

no test coverage detected