Skip to content

Commit

Permalink
remotes and default mvp?
Browse files Browse the repository at this point in the history
  • Loading branch information
jtagcat committed Jun 26, 2022
1 parent cf49b5d commit d16fc0f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions cmd/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var cmdDefault = &cli.Command{
},
}

// git id default clear
var cmdDefaultClear = &cli.Command{
Name: "clear",
Usage: "Clear previously set default key",
Expand Down
26 changes: 14 additions & 12 deletions cmd/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var cmdRemoteAdd = &cli.Command{
},
}

// git id remote rm
var cmdRemoteRemove = &cli.Command{
Name: "rm",
Usage: "Remove a remote",
Expand Down Expand Up @@ -94,24 +95,25 @@ var cmdRemoteRemove = &cli.Command{
return fmt.Errorf("remote %s does not exist", suffixSlug)
}

// get children
// get/remove children identities
// Host jc.gh.git-id
for _, t := range trees {
if !recursive && t.Values[0] != "*"+suffixSlug {
return fmt.Errorf("not deleting remote %s as it has children: use --recursive", slug)
if t.Values[0] != "*"+suffixSlug {
if !recursive {
return fmt.Errorf("cannot delete remote %s: has attached identities (use --recursive)", slug)
}

if ok := c.GIDRootObjectRemoveFirst("Host", t.Values); !ok {
return fmt.Errorf("race‽ (report bug?): identity doesn't exist, but it just did")
}
}
}

// Match OriginalHost github.com

// get defaults

// refuse

// remove
// remove remote
if ok := c.GIDRootObjectRemoveFirst("Host", []string{suffixSlug}); !ok {
return fmt.Errorf("race‽ (report bug?): remote doesn't exist, but it just did")
}

// if ok := c.GIDRootObjectRemove()
return fmt.Errorf("not implemented")
return c.Write()
},
}
3 changes: 2 additions & 1 deletion pkg/encoding/ssh_config/git-id_hotdriver_xyz.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ func (c *Config) GID_InsertRootComment(s string) {
c.cfg = append(c.cfg, RawTopLevel{Comment: s})
}

// WARN: made _only_ for git-id, may break
func (c *Config) GID_PreappendInclude(i string) {
c.cfg = append(
[]RawTopLevel{{Key: "Include", Values: []RawValue{{Value: i, Quoted: 2}}}},
Expand Down Expand Up @@ -92,7 +93,7 @@ func (c *Config) GID_RootObjectSetFirst(key string, values []string, firstValueI
})
}

// WARN: made _only_
// WARN: made _only_ for git-id, may break
func (c *Config) GIDRootObjectRemoveFirst(key string, values []string) (ok bool) {
i := func(config []RawTopLevel) int {
for i, root := range config {
Expand Down

0 comments on commit d16fc0f

Please sign in to comment.