Ignore a shebang in a packages-file.
expeehaa opened this issue · 0 comments
Motivation
I have a small list of atom packages I want to install into any of my current and future atom installations.
It is possible to install it through apm install --packages-file packages-file.txt
.
However, this requires me to remember the command or take the time to look up the correct arguments.
Instead, I would like to create an executable that runs command.
One simple way would be to create a shell script like this (not tested):
#!/bin/bash
cat <<PACKAGES | xargs apm install
package1
package2
PACKAGES
However, it might be done even simpler with an executable file with the following content.
#!/usr/bin/env -S apm install --packages-file
package1
package2
This currently does not work because apm treats every line in a packages file as a package.
Implementation ideas
Idea 1: Allow comments.
I couldn’t find documentation on package naming rules with a quick search, but I doubt that package names with #
symbols are possible.
If so, this symbol could be treated as the beginning of a comment, regardless of whether it starts a line or is placed after a package name.
An implementation of this could be done by changing a single line (+ tests).
Then the following file
#!/some/shebang
package1
package2 # This is a comment.
# This is also a comment.
package3
would be interpreted by apm install --packages-file
as
package1
package2
package3
Idea 2: Only ignore a shebang line.
Alternatively, if for whatever reason the above approach is not possible/desired, the first line of a packages file could be ignored, if it looks like a shebang (i.e. starts with #!
).
I would prefer having comment support and would be able to create a pull request for this.