Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(tools): allow files on imports tool #517

Merged
merged 1 commit into from
Feb 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions cmd/tk/tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func jpathCmd() *cli.Command {

func importsCmd() *cli.Command {
cmd := &cli.Command{
Use: "imports <directory>",
Use: "imports <path>",
Short: "list all transitive imports of an environment",
Args: workflowArgs,
}
Expand All @@ -87,21 +87,12 @@ func importsCmd() *cli.Command {
}
}

dir, err := filepath.Abs(args[0])
path, err := filepath.Abs(args[0])
if err != nil {
return fmt.Errorf("Loading environment: %s", err)
}

fi, err := os.Stat(dir)
if err != nil {
return fmt.Errorf("Loading environment: %s", err)
}

if !fi.IsDir() {
return fmt.Errorf("The argument must be an environment's directory, but this does not seem to be the case.")
}

deps, err := jsonnet.TransitiveImports(dir)
deps, err := jsonnet.TransitiveImports(path)
if err != nil {
return fmt.Errorf("Resolving imports: %s", err)
}
Expand Down