Skip to content

Query command examples ​

Inputs and outputs below were captured from the built command using synthetic settings. Colours preserve the executable's actual ANSI choices; JSON remains colour-free. These reference fixtures use example.invalid hosts and are separate from the 127.0.0.1 quick-start fixture. Placeholder fixture paths must be replaced with your local paths. No external server was contacted.

Start with the CLI quick start for a complete fixture you can create and query immediately. See the full output reference for every captured case.

list (terminal) ​

sh
openssh-js list --file <fixture-directory>\config --color

Exit code: 0.

stdout ​

• Demo (Private key: <home-directory>\.ssh\id_ed25519)

list (JSON) ​

sh
openssh-js list --file <fixture-directory>\config --json

Exit code: 0.

stdout ​

json
[
  {
    "path": "Demo",
    "host": "shell.example.invalid",
    "protocol": "ssh",
    "keyFile": "<home-directory>\\.ssh\\id_ed25519",
    "remoteDirectory": ""
  }
]

list (table) ​

sh
openssh-js list --file <fixture-directory>\config --table --color

Exit code: 0.

stdout ​

┌──────┬───────────────────────┬──────────┬─────────────────────────────┬────────┐
│ Path │ Host                  │ Protocol │ Private key                 │ Remote │
├──────┼───────────────────────┼──────────┼─────────────────────────────┼────────┤
│ Demo │ shell.example.invalid │ ssh      │ <home-directory>\.ssh\id_ed25519 │        │
└──────┴───────────────────────┴──────────┴─────────────────────────────┴────────┘
sh
openssh-js search example --file <fixture-directory>\config --color

Exit code: 0.

stdout ​

Found 1 profile

┌──────────────────┬─────────────────────────────┐
│ Label            │ Value                       │
├──────────────────┼─────────────────────────────┤
│ Name             │ Demo                        │
│ Path             │ Demo                        │
│ Protocol         │ ssh                         │
│ Host             │ shell.example.invalid       │
│ Port             │ 22                          │
│ Username         │ deploy                      │
│ Password         │                             │
│ Passphrase       │                             │
│ Credential state │ not-stored                  │
│ Authentication   │                             │
│ Private key      │ <home-directory>\.ssh\id_ed25519 │
│ Remote           │                             │
└──────────────────┴─────────────────────────────┘

get (JSON) ​

sh
openssh-js get Demo --file <fixture-directory>\config --json

Exit code: 0.

stdout ​

json
{
  "name": "Demo",
  "path": "Demo",
  "protocol": "ssh",
  "host": "shell.example.invalid",
  "port": 22,
  "user": "deploy",
  "password": "(hidden)",
  "passphrase": "(hidden)",
  "credentialState": "not-stored",
  "credentials": [],
  "authentication": "",
  "keyFile": "<home-directory>\\.ssh\\id_ed25519",
  "remoteDirectory": "",
  "connections": [
    {
      "id": "connection",
      "kind": "ssh",
      "protocol": "ssh",
      "endpoint": {
        "host": "shell.example.invalid",
        "port": 22,
        "username": "deploy"
      },
      "authentication": [
        {
          "type": "private-key",
          "path": {
            "value": "<home-directory>\\.ssh\\id_ed25519",
            "format": "native"
          },
          "format": "openssh"
        },
        {
          "type": "agent",
          "agent": "SSH_AUTH_SOCK"
        },
        {
          "type": "interactive"
        }
      ]
    }
  ],
  "diagnostics": [],
  "source": {
    "id": "openssh:<fixture-directory>\\config",
    "application": "openssh",
    "location": "<fixture-directory>\\config",
    "storage": [
      {
        "kind": "file",
        "path": "<fixture-directory>\\config"
      }
    ]
  }
}

get a property ​

sh
openssh-js get Demo host --file <fixture-directory>\config --json

Exit code: 0.

stdout ​

json
"shell.example.invalid"

source ​

sh
openssh-js source --file <fixture-directory>\config --json

Exit code: 0.

stdout ​

json
{
  "id": "openssh:<fixture-directory>\\config",
  "application": "openssh",
  "location": "<fixture-directory>\\config",
  "storage": [
    {
      "kind": "file",
      "path": "<fixture-directory>\\config"
    }
  ]
}

sources ​

sh
openssh-js sources --file <fixture-directory>\config --json

Exit code: 0.

stdout ​

json
{
  "candidates": [
    {
      "id": "openssh:<fixture-directory>\\config",
      "application": "openssh",
      "location": "<fixture-directory>\\config",
      "storage": [
        {
          "kind": "file",
          "path": "<fixture-directory>\\config"
        }
      ]
    }
  ],
  "selectedSourceId": "openssh:<fixture-directory>\\config",
  "selectedBy": "only-candidate",
  "diagnostics": []
}