Open candid frontend by clicking canister id in iTerm2

Thanks to a hint from @alexa.smith & @chenyan I no longer have to copy paste canister IDs :slight_smile:

If you are using iTerm2, follow these steps:

  1. In your iTerm2 Preferences, go to Profiles -> Advanced -> Smart Selection -> Edit
  2. Click the + button to add a new rule and set the Regular Expression to [a-z]{5}-[a-z]{5}-[a-z]{5}-[a-z]{5}-[a-z]{3}
  3. Click on Edit Actions... and add a new action
  4. Set the Action to Open URL...
  5. Set the Parameter to http://127.0.0.1:8000/candid?canisterId=\0 and name it open candid
  6. Add another action with Action set to Open URL... and the Parameter set to http://127.0.0.1:8000/?canisterId=\0 and name it open frontend

You can now CMD+left_click canister IDs to directly open their candid frontend, you can also CMD+right_click to choose the open frontend action instead.

3 Likes

Thanks for putting this up! A minor correction to the regex: [a-z0-9]{5}(-[a-z0-9]{5})*-[a-z0-9]{1,5}

2 Likes