5 ms·
Instead of having a hierarchy of scripts, why not use namespaces - blog_publish, blog_preview, etc? Then instead of typing `sd blog publish`, you type `blog_pub
by laurent123456 4y ago
Instead of having a hierarchy of scripts, why not use namespaces - blog_publish, blog_preview, etc? Then instead of typing `sd blog publish`, you type `blog_publish`. With this you have built-in autocompletion, no need for a third-party tool, a shorter command, and an easy way to see all your scripts at a glance since they'll all be in the same directory.
- dradtke 4y agosd seems to provide a description for the command, too, which your solution wouldn't provide.
- davidpfarrell 4y agoI'd say one reason is that nobody wants to type '_' :) Maybe using '.' would work (ie. blog.publish) but the sub-command pattern (ie space separating) seems well established and slightly easier than typing '.'
- ianthehenry 4y agoYou can also set the PATH_DIRS shell option and type, e.g. `blog/publish` if you have a ~/bin/blog directory full of scripts. Easier than an underscore. I mean, yeah, sd is only a marginal improvement over not sd. It's not a lifechanging script. The differences are: 1. sd makes it easier to create new scripts. Instead of vim ~/bin/blog_publish, writing out the shebang, chmod +x ~/bin/blog_publish, you say `sd blog publish --new`. It sets the permissions and preloads it with a template. 2. Ditto for for other convenience commands: `sd blog publish --edit`, `sd blog publish --cat`. 3. Auto-generates usage text in the autocomplete menu. 4. sd scripts exist in a separate autocomplete namespace from non-sd scripts. b<tab> gives you, you know, bison, binhex, any commands on your PATH. sd b<tab> gives you only your user scripts that start with b. 5. Hierarchical autocomplete is more convenient, if you have more than one level of namespacing.