Skip to content

Commit

Permalink
feat: support using current directory name as env name in envd descri…
Browse files Browse the repository at this point in the history
…be (#1033)

Signed-off-by: fatelei <fatelei@gmail.com>

Signed-off-by: fatelei <fatelei@gmail.com>
  • Loading branch information
fatelei authored Oct 16, 2022
1 parent 99d1690 commit ec92a29
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions pkg/app/env_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package app
import (
"io"
"os"
"path/filepath"

"github.com/cockroachdb/errors"
"github.com/olekukonko/tablewriter"
Expand All @@ -27,16 +28,24 @@ import (
"github.com/tensorchord/envd/pkg/types"
)

func getCurrentDirOrPanic() string {
dir, err := os.Getwd()
if err != nil {
panic(err)
}
return filepath.Base(dir)
}

var CommandDescribeEnvironment = &cli.Command{
Name: "describe",
Aliases: []string{"d"},
Usage: "Show details about environments, including dependencies and port binding",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "env",
Usage: "Specify the envd environment to use",
Aliases: []string{"e"},
Required: true,
Name: "env",
Usage: "Specify the envd environment to use",
Aliases: []string{"e"},
Value: getCurrentDirOrPanic(),
},
},
Action: getEnvironmentDescriptions,
Expand Down

0 comments on commit ec92a29

Please sign in to comment.