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
putty-js list --file <fixture-directory>\sessions.reg --color

Exit code: 0.

stdout ​

• Demo (Private key: C:\keys\example.ppk)

list (JSON) ​

sh
putty-js list --file <fixture-directory>\sessions.reg --json

Exit code: 0.

stdout ​

json
[
  {
    "path": "Demo",
    "host": "shell.example.invalid",
    "protocol": "ssh",
    "keyFile": "C:\\keys\\example.ppk",
    "remoteDirectory": ""
  }
]

list (table) ​

sh
putty-js list --file <fixture-directory>\sessions.reg --table --color

Exit code: 0.

stdout ​

┌──────┬───────────────────────┬──────────┬─────────────────────┬────────┐
│ Path │ Host                  │ Protocol │ Private key         │ Remote │
├──────┼───────────────────────┼──────────┼─────────────────────┼────────┤
│ Demo │ shell.example.invalid │ ssh      │ C:\keys\example.ppk │        │
└──────┴───────────────────────┴──────────┴─────────────────────┴────────┘
sh
putty-js search example --file <fixture-directory>\sessions.reg --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   │ connection/password: not-stored │
│ Private key      │ C:\keys\example.ppk             │
│ Remote           │                                 │
└──────────────────┴─────────────────────────────────┘

get (JSON) ​

sh
putty-js get Demo --file <fixture-directory>\sessions.reg --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": [
    {
      "connectionId": "connection",
      "kind": "password",
      "state": "not-stored"
    }
  ],
  "authentication": "connection/password: not-stored",
  "keyFile": "C:\\keys\\example.ppk",
  "remoteDirectory": "",
  "connections": [
    {
      "id": "connection",
      "kind": "ssh",
      "protocol": "ssh",
      "endpoint": {
        "host": "shell.example.invalid",
        "port": 22,
        "username": "deploy"
      },
      "authentication": [
        {
          "type": "private-key",
          "path": {
            "value": "C:\\keys\\example.ppk",
            "format": "native"
          },
          "format": "ppk"
        },
        {
          "type": "password",
          "credential": {
            "sourceId": "putty:<fixture-directory>\\sessions.reg",
            "id": "Demo",
            "state": "not-stored",
            "kind": "password"
          }
        },
        {
          "type": "agent"
        }
      ]
    }
  ],
  "diagnostics": [],
  "source": {
    "id": "putty:<fixture-directory>\\sessions.reg",
    "application": "putty",
    "location": "<fixture-directory>\\sessions.reg",
    "storage": [
      {
        "kind": "file",
        "path": "<fixture-directory>\\sessions.reg"
      }
    ]
  }
}

get a property ​

sh
putty-js get Demo host --file <fixture-directory>\sessions.reg --json

Exit code: 0.

stdout ​

json
"shell.example.invalid"

source ​

sh
putty-js source --file <fixture-directory>\sessions.reg --json

Exit code: 0.

stdout ​

json
{
  "id": "putty:<fixture-directory>\\sessions.reg",
  "application": "putty",
  "location": "<fixture-directory>\\sessions.reg",
  "storage": [
    {
      "kind": "file",
      "path": "<fixture-directory>\\sessions.reg"
    }
  ]
}

sources ​

sh
putty-js sources --file <fixture-directory>\sessions.reg --json

Exit code: 0.

stdout ​

json
{
  "candidates": [
    {
      "id": "putty:<fixture-directory>\\sessions.reg",
      "application": "putty",
      "location": "<fixture-directory>\\sessions.reg",
      "storage": [
        {
          "kind": "file",
          "path": "<fixture-directory>\\sessions.reg"
        }
      ]
    }
  ],
  "selectedSourceId": "putty:<fixture-directory>\\sessions.reg",
  "selectedBy": "explicit",
  "diagnostics": []
}