Skip to content

Commit

Permalink
chore: output to all Procfile
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Feb 16, 2025
1 parent b318ca5 commit dce8669
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
19 changes: 11 additions & 8 deletions cmd/runproc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,35 @@ import (
)

type config struct {
file string
local string
File string
Local string
}

var cfg = &config{}

var rootCmd = &cobra.Command{
Use: "nctl",
Short: "nctl is a tool for managing operator resources",
Use: "runproc",
Short: `runproc is a simple process runner.`,
RunE: func(cmd *cobra.Command, args []string) error {
return runRoot(cmd.Context())
},
}

func init() {
rootCmd.Flags().StringP("file", "f", cfg.file, "Procfile to run.")
rootCmd.Flags().StringP("local", "l", cfg.local, "Local Procfile to append.")
rootCmd.Flags().StringVarP(&cfg.File, "file", "f", cfg.File, "Procfile to run.")
rootCmd.Flags().StringVarP(&cfg.Local, "local", "l", cfg.Local, "Local Procfile to append.")

rootCmd.SilenceUsage = true
rootCmd.SilenceErrors = true
}

func runRoot(ctx context.Context) error {
data, err := os.ReadFile(cfg.file)
data, err := os.ReadFile(cfg.File)
if err != nil {
log.Fatal(err)
}

envData, err := os.ReadFile(cfg.local)
envData, err := os.ReadFile(cfg.Local)
if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions examples/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
demo: watch tail /var/log/system.log
demo2: watch -n 1 date
Empty file added examples/Procfile.local
Empty file.

0 comments on commit dce8669

Please sign in to comment.