-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding addProvider command, and devcontainer
- Loading branch information
1 parent
67a08dc
commit 5fd535f
Showing
5 changed files
with
132 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/go/.devcontainer/base.Dockerfile | ||
|
||
# [Choice] Go version: 1, 1.16, 1.15 | ||
ARG VARIANT="1.16" | ||
FROM mcr.microsoft.com/vscode/devcontainers/go:0-${VARIANT} | ||
|
||
# [Option] Install Node.js | ||
ARG INSTALL_NODE="true" | ||
ARG NODE_VERSION="lts/*" | ||
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi | ||
|
||
# [Optional] Uncomment this section to install additional OS packages. | ||
# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
# && apt-get -y install --no-install-recommends <your-package-list-here> | ||
|
||
# [Optional] Uncomment the next line to use go get to install anything else you need | ||
# RUN go get -u github.com/spf13/cobra | ||
|
||
# [Optional] Uncomment this line to install global node packages. | ||
# RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g <your-package-here>" 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: | ||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/go | ||
{ | ||
"name": "Go", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"args": { | ||
// Update the VARIANT arg to pick a version of Go: 1, 1.16, 1.15 | ||
"VARIANT": "1.16", | ||
// Options | ||
"INSTALL_NODE": "true", | ||
"NODE_VERSION": "lts/*" | ||
} | ||
}, | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined" | ||
], | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"go.toolsManagement.checkForUpdates": "local", | ||
"go.useLanguageServer": true, | ||
"go.gopath": "/go", | ||
"go.goroot": "/usr/local/go" | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"golang.Go", | ||
"GitHub.copilot" | ||
], | ||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "go version", | ||
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. | ||
"remoteUser": "vscode" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
//create two string variables to hold providerName and providerURL | ||
var providerName, providerURL string | ||
|
||
//create cobra command | ||
var addProviderCmd = &cobra.Command{ | ||
Use: "addProvider", | ||
Short: "Adds a git provider for you", | ||
Long: `This command will add a git provider for you`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
//call add provider with the providerName and providerURL keep properties blank | ||
AddProvider(providerName, providerURL) | ||
}, | ||
} | ||
|
||
func init() { | ||
addProviderCmd.Flags().StringVarP(&providerName, "name", "n", "", "Name of the provider") | ||
addProviderCmd.Flags().StringVarP(&providerURL, "url", "u", "", "URL of the provider") | ||
|
||
RootCmd.AddCommand(addProviderCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters