Skip to content
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
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.1.1"
".": "0.1.2"
}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## 0.1.2 (2025-11-20)

Full Changelog: [v0.1.1...v0.1.2](https://github.com/onkernel/hypeman-cli/compare/v0.1.1...v0.1.2)

### ⚠ BREAKING CHANGES

* new logic for parsing arguments

### Features

* new logic for parsing arguments ([de05b62](https://github.com/onkernel/hypeman-cli/commit/de05b6274cb3d3c27dcfe9784a331a9762a8dca5))

## 0.1.1 (2025-11-14)

Full Changelog: [v0.1.0...v0.1.1](https://github.com/onkernel/hypeman-cli/compare/v0.1.0...v0.1.1)
Expand Down
7 changes: 4 additions & 3 deletions pkg/cmd/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"context"
"fmt"

"github.com/onkernel/hypeman-go"
"github.com/onkernel/hypeman-go/option"
"github.com/tidwall/gjson"
"github.com/urfave/cli/v3"
Expand All @@ -20,15 +21,15 @@ var healthCheck = cli.Command{
}

func handleHealthCheck(ctx context.Context, cmd *cli.Command) error {
cc := getAPICommandContext(cmd)
client := hypeman.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}
var res []byte
_, err := cc.client.Health.Check(
_, err := client.Health.Check(
ctx,
option.WithMiddleware(cc.AsMiddleware()),
option.WithMiddleware(debugMiddleware(cmd.Bool("debug"))),
option.WithResponseBodyInto(&res),
)
if err != nil {
Expand Down
36 changes: 18 additions & 18 deletions pkg/cmd/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"context"
"fmt"

"github.com/onkernel/hypeman-cli/pkg/jsonflag"
"github.com/onkernel/hypeman-go"
"github.com/onkernel/hypeman-go/option"
"github.com/tidwall/gjson"
Expand All @@ -17,13 +16,9 @@ var imagesCreate = cli.Command{
Name: "create",
Usage: "Pull and convert OCI image",
Flags: []cli.Flag{
&jsonflag.JSONStringFlag{
&cli.StringFlag{
Name: "name",
Usage: "OCI image reference (e.g., docker.io/library/nginx:latest)",
Config: jsonflag.JSONConfig{
Kind: jsonflag.Body,
Path: "name",
},
},
},
Action: handleImagesCreate,
Expand Down Expand Up @@ -63,17 +58,22 @@ var imagesDelete = cli.Command{
}

func handleImagesCreate(ctx context.Context, cmd *cli.Command) error {
cc := getAPICommandContext(cmd)
client := hypeman.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}
params := hypeman.ImageNewParams{}
if err := unmarshalStdinWithFlags(cmd, map[string]string{
"name": "name",
}, &params); err != nil {
return err
}
var res []byte
_, err := cc.client.Images.New(
_, err := client.Images.New(
ctx,
params,
option.WithMiddleware(cc.AsMiddleware()),
option.WithMiddleware(debugMiddleware(cmd.Bool("debug"))),
option.WithResponseBodyInto(&res),
)
if err != nil {
Expand All @@ -87,7 +87,7 @@ func handleImagesCreate(ctx context.Context, cmd *cli.Command) error {
}

func handleImagesRetrieve(ctx context.Context, cmd *cli.Command) error {
cc := getAPICommandContext(cmd)
client := hypeman.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if !cmd.IsSet("name") && len(unusedArgs) > 0 {
cmd.Set("name", unusedArgs[0])
Expand All @@ -97,10 +97,10 @@ func handleImagesRetrieve(ctx context.Context, cmd *cli.Command) error {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}
var res []byte
_, err := cc.client.Images.Get(
_, err := client.Images.Get(
ctx,
cmd.Value("name").(string),
option.WithMiddleware(cc.AsMiddleware()),
option.WithMiddleware(debugMiddleware(cmd.Bool("debug"))),
option.WithResponseBodyInto(&res),
)
if err != nil {
Expand All @@ -114,15 +114,15 @@ func handleImagesRetrieve(ctx context.Context, cmd *cli.Command) error {
}

func handleImagesList(ctx context.Context, cmd *cli.Command) error {
cc := getAPICommandContext(cmd)
client := hypeman.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}
var res []byte
_, err := cc.client.Images.List(
_, err := client.Images.List(
ctx,
option.WithMiddleware(cc.AsMiddleware()),
option.WithMiddleware(debugMiddleware(cmd.Bool("debug"))),
option.WithResponseBodyInto(&res),
)
if err != nil {
Expand All @@ -136,7 +136,7 @@ func handleImagesList(ctx context.Context, cmd *cli.Command) error {
}

func handleImagesDelete(ctx context.Context, cmd *cli.Command) error {
cc := getAPICommandContext(cmd)
client := hypeman.NewClient(getDefaultRequestOptions(cmd)...)
unusedArgs := cmd.Args().Slice()
if !cmd.IsSet("name") && len(unusedArgs) > 0 {
cmd.Set("name", unusedArgs[0])
Expand All @@ -145,9 +145,9 @@ func handleImagesDelete(ctx context.Context, cmd *cli.Command) error {
if len(unusedArgs) > 0 {
return fmt.Errorf("Unexpected extra arguments: %v", unusedArgs)
}
return cc.client.Images.Delete(
return client.Images.Delete(
ctx,
cmd.Value("name").(string),
option.WithMiddleware(cc.AsMiddleware()),
option.WithMiddleware(debugMiddleware(cmd.Bool("debug"))),
)
}
Loading