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: replace Dockerfile by Containerfile #23

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
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
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