Skip to main content

@g2d/cli

@g2d/cli is an executable npm bin to transform .gitignore to .dockerignore .

Run Remotely​

$ npx -y @g2d/cli

Install Globally​

$ npm i -g @g2d/cli

Usage​

Transform.gitignore into .dockerignore:

$ g2d -o .

stdin / stdout is supported:

$ cat .gitignore | g2d > .dockerignore

By use cases:

# Transform`.gitignore` into `.dockerignore`:
$ g2d -o .
$ g2d > .dockerignore
$ cat .gitignore | g2d > .dockerignore

# Transform`.gitignore` to stdout:
$ g2d
$ cat .gitignore | g2d

# From specific file:
$ g2d /my/.gitignore
$ cat /my/.gitignore | g2d

# Help
$ g2d -h

Usage:
$ g2d [file]

Commands:
[file] Transform a specific file

For more info, run any command with the `--help` flag:
$ g2d --help

Options:
-o, --output <file> Output file
-s, --silent Silent
-h, --help Display this message
-v, --version Display version number

Advanced Usage​

You can integrate running remotely with shell alias and it will always fetch the latest g2d every time.

For example, integrating pnpm dlx with fish shell:

if status is-interactive
alias g2d "pnpm -s --package=@g2d/cli dlx g2d"
end