feat: easier Github bridge configuration

Labels: Easy pick enhancement

Timeline

Michael Muré (MichaelMure) opened (edited)

So I was thinking.

The first step of the Github bridge configurator is to ask the user for the project URL (ex: https://github.com/MichaelMure/git-bug). But the configurator could be smart and look for the configured remote to provide a list the user could pick from.

$ git remote --verbose
origin	git@github.com:MichaelMure/git-bug.git (fetch)
origin	git@github.com:MichaelMure/git-bug.git (push)
adamslc	git@github.com:adamslc/git-bug.git (fetch)
adamslc	git@github.com:adamslc/git-bug.git (push)

Would give:

Detected projects:
[1]: github.com/MichaelMure/git-bug
[2]: github.com/adamslc/git-bug

[0]: another project

If [0] is selected, the current prompt (Github project URL: ) is shown.

Michael Muré (MichaelMure) added label enhancement

Michael Muré (MichaelMure) added label Easy pick

Sladyn (sladyn98) commented

@MichaelMure we could use the os/exec package to do the job out, err := exec.Command("git remote --verbose").Output() if err != nil { fmt.Printf("%s", err) } output := string(out[:]) fmt.Println(output) we could then pick pipe the user input to a buffer and take the necessary action.

Michael Muré (MichaelMure) commented

You could, but please implement a generic function ListRemotes in the interface RepoCommon and the type that implement it. You can then use this new function from the Configure(repo repository.Repo).

Sladyn (sladyn98) commented (edited)

I added the function declaration to RepoCommoninterfacein repo.go and the the implementation in the git.go file.Does the the function have to be called in the config.go of launchpad or github .

Michael Muré (MichaelMure) commented

Lets start with github. I suppose it could be done for launpad as well but i don't know launchpad enough to tell.

Sladyn (sladyn98) commented (edited)

@MichaelMure I added the new function in config.go for github. How do I test that the new features work ? Is there a custom development script or do I have to compile the binaries.

Michael Muré (MichaelMure) commented

@sladyn98 yes you need to compile the program. The easiest way would be to use the Makefile: run make to compile a binary in the root folder.

To make it easier for you, you should make yourself more familiar with go. Maybe take the tour ? https://tour.golang.org/welcome/1

Michael Muré (MichaelMure) closed the bug