devcontainers

package
v0.1.858116614 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2021 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevcontainerSnippetTypeSingleFile = "Snippet:SingleFile"
	DevcontainerSnippetTypeFolder     = "Snippet:Folder"
)

Variables

This section is empty.

Functions

func AddSnippetToDevcontainer added in v0.1.858116614

func AddSnippetToDevcontainer(projectFolder string, snippetName string) error

func CopyTemplateToFolder added in v0.1.858116614

func CopyTemplateToFolder(templatePath string, targetFolder string, devcontainerName string) error

func ExecInDevContainer added in v0.1.816111590

func ExecInDevContainer(containerIDOrName string, workDir string, args []string) error

func GetContainerIDForPath added in v0.1.816111590

func GetContainerIDForPath(devcontainerPath string) (string, error)

GetContainerIDForPath returns the ID of the running container that matches the path

func GetDefaultDevcontainerNameForFolder added in v0.1.259948365

func GetDefaultDevcontainerNameForFolder(folderPath string) (string, error)

func GetDevContainerURI added in v0.1.158565981

func GetDevContainerURI(folderPath string) (string, error)

GetDevContainerURI gets the devcontainer URI for a folder to launch using the VS Code --folder-uri switch

func GetDevContainerUserName added in v0.1.310713546

func GetDevContainerUserName(devContainerJsonPath string) (string, error)

"remoteUser": "vscode"

func GetLocalFolderFromDevContainer added in v0.1.163415964

func GetLocalFolderFromDevContainer(containerIDOrName string) (string, error)

GetLocalFolderFromDevContainer looks up the local (host) folder name from the container labels

func GetWorkspaceMountPath added in v0.1.163415964

func GetWorkspaceMountPath(folderPath string) (string, error)

GetWorkspaceMountPath returns the devcontainer mount path for the devcontainer in the specified folder

func SetDevcontainerName added in v0.1.259948365

func SetDevcontainerName(devContainerJsonPath string, name string) error

Types

type DevcontainerInfo

type DevcontainerInfo struct {
	ContainerID      string
	ContainerName    string
	DevcontainerName string
	LocalFolderPath  string
}

DevcontainerInfo holds details about a devcontainer

func ListDevcontainers

func ListDevcontainers() ([]DevcontainerInfo, error)

ListDevcontainers returns a list of devcontainers

type DevcontainerSnippet added in v0.1.858116614

type DevcontainerSnippet struct {
	Name string
	Type DevcontainerSnippetType
	// Path is the path to either the path to the single script file or to the directory for multi-file snippets
	Path string
}

DevcontainerSnippet holds info on snippets for list/add etc Snippets can be either single script files or a directory with a set of files

func GetSnippetByName added in v0.1.858116614

func GetSnippetByName(name string) (*DevcontainerSnippet, error)

GetSnippetByName returns the template with the specified name or nil if not found

func GetSnippets added in v0.1.858116614

func GetSnippets() ([]DevcontainerSnippet, error)

GetSnippets returns a list of discovered templates

type DevcontainerSnippetType added in v0.1.858116614

type DevcontainerSnippetType string

type DevcontainerTemplate added in v0.1.114116943

type DevcontainerTemplate struct {
	Name string
	// Path is the path including the .devcontainer folder
	Path string
}

DevcontainerTemplate holds info on templates for list/add etc

func GetTemplateByName added in v0.1.114116943

func GetTemplateByName(name string) (*DevcontainerTemplate, error)

GetTemplateByName returns the template with the specified name or nil if not found

func GetTemplates added in v0.1.114116943

func GetTemplates() ([]DevcontainerTemplate, error)

GetTemplates returns a list of discovered templates

type FolderSnippet added in v0.1.858116614

type FolderSnippet struct {
	Actions []FolderSnippetAction `json:"actions"`
}

FolderSnippet maps to the content of the snippet.json file for folder-based snippets

type FolderSnippetAction added in v0.1.858116614

type FolderSnippetAction struct {
	Type       FolderSnippetActionType `json:"type"`
	SourcePath string                  `json:"source"`  // for mergeJSON this is snippet-relative path to JSON. for copyAndRun this is the script filename
	TargetPath string                  `json:"target"`  // for mergeJSON this is project-relative path to JSON
	Content    string                  `json:"content"` // for dockerfileSnippet this is the content to include
}

type FolderSnippetActionType added in v0.1.858116614

type FolderSnippetActionType string
const (
	FolderSnippetActionMergeJSON         FolderSnippetActionType = "mergeJSON"         // merge JSON file from snippet with target JSON file
	FolderSnippetActionCopyAndRun        FolderSnippetActionType = "copyAndRun"        // COPY and RUN script from snippet in the Dockerfile (as with single-file snippet)
	FolderSnippetActionDockerfileSnippet FolderSnippetActionType = "dockerfileSnippet" // snippet to include as-is in the Dockerfile
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL