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 docs/changes-from-proposal.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ The following aliases are not in the proposal but are shipped:
| `localnet resume` | `unpause` | Matches `docker compose unpause` terminology |
| `localnet observability` | `obs` | Shorter for interactive use |
| `localnet container list` | `ls`, `ps` | Matches Docker CLI conventions |
| `localnet list` | `ls` | Short form for listing registered instances |
| `localnet token party ls` | `list` | Consistency within party subcommand |
| `localnet token party rm` | `remove` | Consistency within party subcommand |

`localnet list` has **no** `ls` alias despite the pattern above — adding it would shadow `localnet logs` with a common prefix, increasing ambiguity in tab-completion.

**Behaviour change (removed aliases):** earlier builds shipped `start` as an alias for `up` and `stop` as an alias for `down`. These aliases have been **removed** — `start` and `stop` are now standalone commands with distinct behaviour (see [`localnet stop` / `start`](#localnet-stop--start-new)). `localnet stop` no longer removes containers (use `down` for that), and `localnet start` no longer unconditionally recreates the stack (though it converges to a running instance, falling back to `up` when containers are gone).

Expand Down
24 changes: 24 additions & 0 deletions internal/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ package cli

import (
"bytes"
"encoding/json"
"strings"
"testing"

"github.com/bitdynamics-ab/canton-devkit/internal/api/types"
)

func TestRunShowsRootHelpWithoutArgs(t *testing.T) {
Expand Down Expand Up @@ -93,6 +96,27 @@ func TestRunLocalnetRemove_RequiresTarget(t *testing.T) {
}
}

func TestRunLocalnetListAlias(t *testing.T) {
t.Setenv("CANTON_DEVKIT_REGISTRY", t.TempDir())

var out, errb bytes.Buffer
code := New(&out, &errb, "test", "").Run([]string{"localnet", "ls", "--format=json"})
if code != 0 {
t.Fatalf("localnet ls returned %d; stderr=%q", code, errb.String())
}

var got types.ListResponse
if err := json.Unmarshal(out.Bytes(), &got); err != nil {
t.Fatalf("localnet ls output is not list JSON: %v\noutput=%q", err, out.String())
}
if got.SchemaVersion != types.SchemaVersion {
t.Errorf("schema version = %d, want %d", got.SchemaVersion, types.SchemaVersion)
}
if len(got.Instances) != 0 {
t.Errorf("instances = %+v, want empty registry", got.Instances)
}
}

// TestRunIsArgvOnly documents the DPM-component invocation contract:
// when the binary is launched via a DPM manifest with exec-args:
// ["localnet"], DPM prepends "localnet" and appends user-supplied args.
Expand Down
1 change: 1 addition & 0 deletions internal/cli/localnet/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ func buildList() *cobra.Command {
opts := &localnet.ListOptions{Format: "text"}
cmd := &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "List every Canton LocalNet instance known to this DevKit",
Args: cobra.NoArgs,
SilenceUsage: true,
Expand Down
Loading