From 63725f971cb2d00bffe8a6a7d691e9be53a90e5d Mon Sep 17 00:00:00 2001 From: Juan R <994594+juaoose@users.noreply.github.com> Date: Mon, 6 Apr 2026 12:12:39 -0500 Subject: [PATCH] chore: handle cloud commands from pnf --- cmd/pnf/main.go | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/cmd/pnf/main.go b/cmd/pnf/main.go index 9bfc03a..944de52 100644 --- a/cmd/pnf/main.go +++ b/cmd/pnf/main.go @@ -50,6 +50,8 @@ func main() { fmt.Println("pnf v0.1.0") case "help", "--help", "-h": printUsage() + case "runs", "run", "jobs", "workers", "worker": + delegateToP95() default: // If first arg looks like a flag, assume serve command if strings.HasPrefix(cmd, "-") { @@ -69,10 +71,13 @@ Usage: pnf [options] Commands: - tui Interactive terminal UI with charts - ls List projects and runs - show Show metrics for a run - serve Start the web viewer + tui Interactive terminal UI with charts + ls List projects and runs + show Show metrics for a run + serve Start the web viewer + runs Manage cloud runs + jobs Manage cloud jobs + workers Manage cloud workers Examples: pnf tui --logdir ./logs @@ -81,6 +86,8 @@ Examples: pnf ls --logdir ./logs --project demo-project pnf show --logdir ./logs pnf serve --logdir ./logs + pnf runs list --project team/app + pnf jobs create --project team/app --script train.py Options: --logdir Directory containing logs (default: ~/.p95/logs) @@ -89,6 +96,18 @@ Options: --help Show this help message`) } +func delegateToP95() { + p95, err := exec.LookPath("p95") + if err != nil { + fmt.Fprintf(os.Stderr, "Cloud commands require the p95 Python package.\nInstall it with: pip install p95\n") + os.Exit(1) + } + if err := syscall.Exec(p95, append([]string{p95}, os.Args[1:]...), os.Environ()); err != nil { + fmt.Fprintf(os.Stderr, "Error: %v\n", err) + os.Exit(1) + } +} + // ============================================ // ls command - list projects and runs // ============================================