cyjake / ssh-config

📟 SSH config parser and stringifier
MIT License
80 stars 20 forks source link

[question] How to add START and END block comments? #61

Closed BrunoQuaresma closed 1 year ago

BrunoQuaresma commented 1 year ago

Hi, I would like to add block comments around the config like this:

--- START CODER VSCODE ---
Host coder-vscode--*
    ProxyCommand "...." %h
    ConnectTimeout 0
    StrictHostKeyChecking no
    UserKnownHostsFile /dev/null
    LogLevel ERROR
 --- END CODER VSCODE ---

But I'm not finding a good way to do that. Thanks in advance!

cyjake commented 1 year ago

lines starting with # will be interpreted as comments, you can manually push, unshift, or splice comment into the AST

config.unshift({
    type: 2,
    content: '# start coder vscode',
    before: '\n',
    after: '\n'
});

config.push({
    type: 2,
    content: '# end coder vscode',
    before: '\n',
    after: '\n'
});
BenjaminGrayNp1 commented 1 year ago

Looks like there's nothing left to do here; SSH config doesn't support block comments, so the parser won't help with that.

cyjake commented 1 year ago

yep, I'll close this one