devcontainers

package
v0.1.5524099953 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 24 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(containerID string, workDir string, args []string) error

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 `json:"containerID"`
	ContainerName    string `json:"containerName"`
	DevcontainerName string `json:"devcontainerName"`
	LocalFolderPath  string `json:"localFolderPath"`
}

DevcontainerInfo holds details about a devcontainer

func GetClosestPathMatchForPath added in v0.1.901789955

func GetClosestPathMatchForPath(devContainers []DevcontainerInfo, devcontainerPath string) (DevcontainerInfo, error)

GetClosestPathMatchForPath returns the dev container with the closes match to the specified path

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 DockerMount added in v0.1.901789955

type DockerMount struct {
	Source      string `json:"Source"`
	Destination string `json:"Destination"`
}

DockerMount represents mount info from Docker output

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
	ContentPath string                  `json:"contentPath"` // for dockerfileSnippet this is the path to 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
)

type SourceInfo added in v0.1.968022249

type SourceInfo struct {
	DevcontainerFolder string
	DockerMount        DockerMount
}

SourceInfo holds properties about the source mounted in a dev container

func GetSourceInfoFromDevContainer added in v0.1.968022249

func GetSourceInfoFromDevContainer(containerIDOrName string) (SourceInfo, error)

GetSourceInfoFromDevContainer inspects the specified container and returns the SourceInfo

type SubstitutionValues added in v0.1.861633436

type SubstitutionValues struct {
	Name       string
	UserName   string
	HomeFolder string
}

Jump to

Keyboard shortcuts

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