git2megaignore-0.3.0 is not a library.
Gitignore to Megaignore converter
This is a simple tool to convert a .gitignore file to a .megaignore file. The .megaignore file is used by the Mega cloud storage service to exclude files from being uploaded to the cloud much like the .gitignore file is used to exclude files from being tracked by git.
You can read more about the .megaignore file format here.
Installation
Usage example
# go to a directory with a .gitignore file
# or create a new .gitignore file
# convert the .gitignore file to a .megaignore file
resulting .megaignore file:
+sync:.megaignore
-nG:*.txt
-dnG:foo
-dpR:^[Bb]uild$
-pR:^src/(.*/)?index\.js$
sync:.megaignoreis a special rule that tells Mega to sync the.megaignorefile itself, this was added with the-moption+prefix means that the rule is an include rule-prefix means that the rule is an exclude rulenoption means that the rule should be applied to the file name, not the whole pathpoption means that the rule should be applied to the path of the file, not the file namedoption means that the rule targets directories only, otherwise it targets everythingGoption means that the rule is a case-sensitive glob patternRoption means that the rule is a case-sensitive regex pattern- for more information about the rule format, see the Mega help page
Other usage examples
# take input from stdin and write to stdout
# -e, --no-extras do not add extra header and footer lines
# -p, --print print to stdout
# -v, --verbose <VERBOSE> set verbosity level (0-4)
|
)
# copy .gitignore lines when converting to .megaignore
# -c --copy copy .gitignore lines to the .megaignore file
|
# from /[Ll]ibrary/
# run from other directory
# this will read the .gitignore file from the specified directory
# and write the .megaignore file to the same directory
# specify input and output files explicitly
Mass conversion
you can run the following bash script to convert all .gitignore files in the subdirectories of the current directory to .megaignore files:
for windows, you can use the following powershell script:
Get-ChildItem -Recurse -Filter .gitignore | ForEach-Object { git2megaignore $_.DirectoryName }