Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Ignore a shebang in a packages-file. #938

Open
expeehaa opened this issue Oct 29, 2021 · 0 comments
Open

Ignore a shebang in a packages-file. #938

expeehaa opened this issue Oct 29, 2021 · 0 comments

Comments

@expeehaa
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant