Skip to content

Commit

Permalink
subdirectories of commands/* should not show up as custom commands (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
rfay committed Feb 4, 2020
1 parent be0f12e commit de89fd2
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cmd/ddev/cmd/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ func addCustomCommands(rootCmd *cobra.Command) error {
}

for _, commandName := range commandFiles {
if strings.HasSuffix(commandName, ".example") || strings.HasPrefix(commandName, "README") || strings.HasPrefix(commandName, ".") || fileutil.IsDirectory(commandName) {
continue
}

// Use path.Join() for the inContainerFullPath because it's about the path in the container, not on the
// host; a Windows path is not useful here.
inContainerFullPath := path.Join("/mnt/ddev_config/commands", service, commandName)
onHostFullPath := filepath.Join(topCommandPath, service, commandName)

if strings.HasSuffix(commandName, ".example") || strings.HasPrefix(commandName, "README") || strings.HasPrefix(commandName, ".") || fileutil.IsDirectory(onHostFullPath) {
continue
}

// Any command we find will want to be executable on Linux
_ = os.Chmod(onHostFullPath, 0755)

Expand Down

0 comments on commit de89fd2

Please sign in to comment.