Copy-Paste-Notes

Evaluate a stored command

$ cpn list --format json | jq -r '.[] | select(.title == "echo test")'
{
  "id": 6,
  "title": "echo test",
  "description": "echo \"Hello World\"",
  "createTimestamp": "2023-08-17 13:24:16"
}

$ eval $(cpn get --title "echo test" -f json | jq -r '.description')
Hello World

Evaluate a stored command with variables

$ cpn get --id 5 --format json | jq -r
{
  "id": 5,
  "title": "params test",
  "description": "echo Hello $TYPE, my name is $NAME",
  "createTimestamp": "2023-08-10 12:40:39"
}

$ TYPE=World NAME=bob eval $(cpn get --title "params test" -f json | jq -r '.description')
Hello World, my name is bob