Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmdm committed May 27, 2021
1 parent 2653845 commit 03befb0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
18 changes: 12 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,16 @@ contexts:
# Ideas/questions

- yey!
- Do we really need a default/current context (instead of always specifying)
- Do we really need to names containers with tag?
- Simplify context file format
- .yeyrc
- Move base to top level?
- Default user.yaml could be just shared.yaml initially all commented out
- No different naming (user.yaml/shared.yaml), just `.yeyrc` or `.yey.yaml`

- yey start flags: --rm && --reset

- yey user support??? can we run our containers as not root via context config or otherwise? SPIKE

- Currently we have image support in contextFile, how about Dockerfile support? BOOM

- yey rm [contextName/prompt] -> removes containers with prefix yey-pathHash-contextName-\*

- rm --all remove all contexts

- yey tidy -> removes containers from all context names that are not references: yey-pathHash-contextNames-notusedContextHash
1 change: 1 addition & 0 deletions src/internal/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
// Context represents execution configuration for some docker container
type Context struct {
Name string `yaml:",omitempty"`
Remove bool
Image string
Env map[string]string
Mounts map[string]string
Expand Down
15 changes: 9 additions & 6 deletions src/internal/docker/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"os"
"os/exec"
"regexp"
"strings"

"github.com/mitchellh/go-homedir"
Expand All @@ -30,13 +31,15 @@ func Start(ctx context.Context, yeyCtx yey.Context, containerName string) error
}
}

var newlines = regexp.MustCompile(`\r?\n`)

func ListContainers(ctx context.Context) ([]string, error) {
cmd := exec.Command("docker", "ps", "--all", "--filter", "name=yey-*", "--format", "{{.Names}}")
output, err := cmd.Output()
if err != nil {
return nil, err
}
return strings.Split(string(output), "\n"), nil
return newlines.Split(string(output), -1), nil
}

func getContainerStatus(ctx context.Context, name string) (string, error) {
Expand All @@ -61,12 +64,12 @@ func runContainer(ctx context.Context, yeyCtx yey.Context, containerName string)

args := []string{
"run",
"--name", containerName,
"-it",
// "--env LS_COLORS",
// "--env TERM",
// "--env TERM_COLOR",
// "--env TERM_PROGRAM",
"--name", containerName,
"--env", "LS_COLORS",
"--env", "TERM",
"--env", "TERM_COLOR",
"--env", "TERM_PROGRAM",
"--env", "YEY_WORK_DIR=" + cwd,
"--env", "YEY_CONTEXT=" + yeyCtx.Name,
}
Expand Down

0 comments on commit 03befb0

Please sign in to comment.