coffee-tools / coffee

Reference implementation for a flexible core lightning plugin manager
https://docs.page/coffee-tools/coffee
9 stars 13 forks source link

fix(cmd): add network validation in coffee cmd inputs #274

Closed Anyitechs closed 1 month ago

Anyitechs commented 2 months ago

This PR validates the argument passed into the -n flag, and ensures only supported CLN networks are created in the /Users/User/.coffee directory, and closes #270 .

Implementation

The current implementation consists of:

Current Behaviour

The validation works as expected, so passing in a random name as the network name will not create the directory but the command returns the same output as below regardless of the network name. Also, passing in a random network name and running coffee -n remote list for the first time ignores the invalid network name and creates a /Users/ifeanyichukwu/.coffee/bitcoin directory for example, but running the command again doesn't create a ../.coffee/bitcoin directory again.

ifeanyichukwu@IfeanyiukwusMBP coffee % coffee -n remote list
● Plugins installed
╭───────────────────────────────────────────╮
│ ●   Language   Name   Enabled   Exec path 
├───────────────────────────────────────────┤
╰───────────────────────────────────────────╯

How to test

netlify[bot] commented 2 months ago

Deploy Preview for coffee-docs canceled.

Name Link
Latest commit ddaa0dc1a51021d5fe37effe301f944c49c58049
Latest deploy log https://app.netlify.com/sites/coffee-docs/deploys/663e32a72b1e1600078188cd
Anyitechs commented 2 months ago

Thank you for the review. I'll work on the requested changes and update the PR.

Anyitechs commented 1 month ago

Good code, some small minor changes

Thank you for the review. I've addressed all the requested changes and updated the PR.

Let me know if there's anything I'm missing.