Skip to content

Commit

Permalink
fix: replace Dockerfile by Containerfile (#23)
Browse files Browse the repository at this point in the history
Fixes #5

Signed-off-by: Jeff MAURY <[email protected]>
  • Loading branch information
jeffmaury authored Nov 17, 2023
1 parent 3c27c43 commit d732be8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/cli/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (
func NewCmdAnalyze() *cobra.Command {
analyzeCmd := &cobra.Command{
Use: "analyze",
Short: "Analyze the Dockerfile and discover potential issues when deploying it on OpenShift",
Long: "Analyze the Dockerfile and discover potential issues when deploying it on OpenShift. It accepts the project root path or the Dockerfile path.",
Short: "Analyze the Containerfile and discover potential issues when deploying it on OpenShift",
Long: "Analyze the Containerfile and discover potential issues when deploying it on OpenShift. It accepts the project root path or the Containerfile path.",
Args: cobra.MaximumNArgs(0),
Run: doAnalyze,
Example: ` doa analyze -f /your/local/project/path[/Dockerfile_name]`,
Example: ` doa analyze -f /your/local/project/path[/Containerfile_name]`,
}
analyzeCmd.PersistentFlags().StringP(
"file", "f", "", "Container file to analyze",
Expand Down Expand Up @@ -55,10 +55,10 @@ func doAnalyze(cmd *cobra.Command, args []string) {

func PrintNoArgsWarningMessage(command string) {
fmt.Printf(`
No arg received. Did you forget to add the dockerfile or project path to analyze?
No arg received. Did you forget to add the Containerfile or project path to analyze?
Expected:
doa %s /your/local/project/path[/Dockerfile_name] [flags]
doa %s /your/local/project/path[/Containerfile_name] [flags]
To find out more, run 'doa %s --help'
`, command, command)
Expand Down
6 changes: 3 additions & 3 deletions pkg/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (

var (
doaLong = `
The Docker OpenShift Analyzer is a CLI tool for finding and highlighting potential issues a Dockerfile could have on an OpenShift cluster.
The Docker OpenShift Analyzer is a CLI tool for finding and highlighting potential issues a Containerfile could have on an OpenShift cluster.
Find out more at https://github.com/lstocchi/docker-openshift-analyzer
`

doaExample = `
# Analyze the Dockerfile of a project:
doa analyze /your/local/project/path[/Dockerfile_name]
# Analyze the Containerfile of a project:
doa analyze /your/local/project/path[/Containerfile_name]
`

rootHelpMessage = "To see a full list of commands, run 'doa --help'"
Expand Down
5 changes: 4 additions & 1 deletion pkg/command/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func AnalyzePath(path string) []error {

if fileInfo.IsDir() {
path = filepath.Join(path, "Dockerfile")
if _, err := os.Stat(path); err != nil {
path = filepath.Join(filepath.Base(path), "Containerfile")
}
}

file, err := os.Open(path)
Expand All @@ -70,7 +73,7 @@ func AnalyzeFile(file *os.File) []error {
res, err := parser.Parse(file)
if err != nil {
return []error{
fmt.Errorf("unable to analyze the Dockerfile. Error when parsing %s : %s", file.Name(), err.Error()),
fmt.Errorf("unable to analyze the Containerfile. Error when parsing %s : %s", file.Name(), err.Error()),
}
}

Expand Down

0 comments on commit d732be8

Please sign in to comment.