Coder Social home page Coder Social logo

gi_gen's Introduction

GI Gen - Gitignore File Generator

Table of Contents

GI Gen is an open source CLI to generate .gitignore files for most project types.

Simply run the command and follow the prompts, and your project will have a .gitignore file to match it.

It is completely cross-platform, and standalone (no dependencies - other than git itself), so you may literally use it for any project on any platform.

You can run this CLI program to create or append a .gitignore file from a chosen list of template easily.

You may choose more than one template to generate.

Check out the VS Code Extension!

Features

GI Gen supports the following features:

  • .gitignore discovery:
    • Auto-discover any gitignore templates that might be related to your project
      • Can confidently discover over 50 project languages using your project structure
      • Can fall back on process of elimination using patterns in the template
    • Optionally list all available templates instead (see github/gitignore for the complete list of templates)
  • .gitignore clean: Clean up results from any patterns that aren't in your project before outputting (optional)
  • Writes to .gitignore file in current directory (you may overwrite/skip/append if already exists)

Command Line Usage

Download the file for your platform in the Releases page.

Put it anywhere that you can run an executable from. It is completely portable to any directory, but it is preferable you put it somewhere that is in your PATH.

Just run gi_gen in the directory you wish to add to and follow the prompts.

$ gi_gen

Command Line Flags

You may pass additional flags to gi_gen. These are the currently available flags:

Usage Description
-languages | -l List the languages you want to use as templates.
To add multiple templates, use commas as separators, e.g.: -languages Node,Python
-auto-discover | -d Use auto-discovery for project, detecting the project type and using the result as the pre-selected template list.
-clean-output | -c Perform cleanup on the output .gitignore file, removing any unused patterns
-keep-output | -k Do not perform cleanup on the output .gitignore file, keep all the original contents
-append | -a Append to .gitignore file if it already exists
-overwrite | -w Overwrite .gitignore file if it already exists
-detect-languages Outputs the automatically-detected languages, separated by newlines, and exits. Useful for outside tools detection.
-all-languages Outputs all the available languages, separated by newlines, and exits. Useful for outside tools detection.
-clear-cache Clear the .gitignore cache directory, for troubleshooting or for removing trace files of this program.
Exits after running, so other flags will be ignored.
-help | -h Display help message

Examples

  • Run normally, prompting for every step:

    gi_gen
  • Pre-select languages (skip prompt):

    gi_gen -languages Node          # One language
    gi_gen -languages Node,Python   # Multiple languages
  • Perform clean up (skip prompt):

    gi_gen -clean-output    # clean up
    gi_gen -keep-output     # skip clean up
  • Use auto-discovery (skip prompt):

    gi_gen -auto-discover
  • Existing file handlers (skip prompt):

    gi_gen -append      # if file exists, add to end of it
    gi_gen -overwrite   # if file exists, replace the existing content
  • Combined (skip all prompts):

    gi_gen -d -c -a       # Use auto discovery, append and clean unused patterns
    gi_gen -l Node -k -w  # Use passed languages, overwrite and keep unused patterns
  • Clean cache directory and exit:

    gi_gen -clear-cache
  • Detect languages and output the results, then exit:

    gi_gen -detect-languages

Contribute

Credits to open-source-ideas for the idea for the tool.

Please feel free to open PRs or issues with bug fixes/reports, or feature requests.

This project was built using Go, and should run easily with the normal Go tools with no further configuration.

Tested on all major platforms, but feel free to report any issues on your platform if you have any, or are missing your platform and cannot/don't want to build from source (I tried building for the most common platforms).

If you are feeling incredibly generous and appreciate the time & effort I put into developing this tool, kindly consider donating any amount to help me make up for the work hours. It is really very much appreciated! ๐Ÿ™๐Ÿผ

Buy Me a Coffee at ko-fi.com

gi_gen's People

Contributors

chenasraf avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gi_gen's Issues

Compiled binaries do not work - exit status 128

Currently there is an issue on some/all compiled binaries on GitHub that cause the program to immediately exit with status code 128 in the output (the actual status code is 1).

Log:

โžœ  Downloads ./gi_gen
2022/05/19 00:11:38 exit status 128

Not sure what causes this.

Confirmed to be reproducible on:

  • Windows
  • Linux x86
  • Linux ARM
  • macOS ARM
  • macOS Intel

The locally compiled binary for the currently confirmed platforms does work, so this might be an issue with the build process on GitHub actions.

Attempted GH actions to build:

Please use this issue to report if you have the same issue, and any debugging information you may have will help as I was not able to produce any information to investigate from.

True Project Detection Support

In my plans for v1 release, I want the program to truly attempt to discover the relevant gitignore templates.

One way I thought about going at it is a simple file existence check on common language defaults.

For example, package.json or tsconfig.json for Node, __init__.py or setup.py for Python, pubspec.yaml for Dart, etc.

I am leaving this issue here if anyone wants to help fill the database of relevant files. I haven't touched all of the possible languages in the list, so I wouldn't know how to detect most of them.

This list will be kept up-to-date with the current languages being supported:

  • Actionscript - *.as
  • Ada - *.{adb,ada,ads}
  • Agda - *.agda
  • AL
  • Android
  • AppceleratorTitanium
  • AppEngine
  • ArchLinuxPackages
  • Autotools
  • C - *.{c,cats,h,idc,w}
  • C++ - *.{cpp,c++,cc,cp,cxx,h,h++,hh,hpp,hxx,inc,inl,ipp,tcc,tpp}
  • CakePHP
  • CFWheels
  • ChefCookbook
  • Clojure - *.{clj,boot,cl2,cljc,cljs,cljs.hl,cljscm,cljx,hic}
  • CMake - *.{cmake,cmake.in}
  • CodeIgniter
  • CommonLisp
  • Composer - composer.json
  • Concrete5
  • Coq - *.{coq,v}
  • CraftCMS
  • CUDA - *.{cu,cuh}
  • D - *.{d,di}
  • Dart - *.dart, pubspec.ya?ml
  • Delphi
  • DM - *.dm
  • Drupal
  • Eagle - *.{sch,brd}
  • Elisp
  • Elixir - *.{ex,exs}
  • Elm - *.elm
  • EPiServer
  • Erlang - *.{erl,es,escript,hrl,xrl,yrl}
  • ExpressionEngine
  • ExtJs
  • Fancy - *.{fy,fancypack}
  • Finale
  • FlaxEngine
  • ForceDotCom
  • Fortran - *.{f90,f,f03,f08,f77,f95,for,fpp}
  • FuelPHP
  • Gcov
  • GitBook
  • Go - go.{mod,sum}, *.go
  • Godot - *.godot
  • Gradle - *.gradle
  • Grails
  • GWT
  • Haskell - *.{hs,hsc}
  • Idris - *.{idr,lidr}
  • IGORPro
  • Java - *.java
  • JBoss
  • Jekyll - config.ya?ml
  • JENKINS_HOME - Jenkinsfile, jobs
  • Joomla
  • Julia - *.jl
  • KiCad - *.{sch,brd,kicad_pcb}
  • Kohana
  • Kotlin - *.{kt,ktm,kts}
  • LabVIEW - *.lvproj
  • Laravel
  • Leiningen
  • LemonStand
  • Lilypond - *.{ly,ily}
  • Lithium
  • Lua - *.{lua,fcgi,nse,pd_lua,rbxs,wlua}
  • Magento
  • Maven
  • Mercury - *.{m,moo}
  • MetaProgrammingSystem
  • Nanoc
  • Nim
  • Node - package.json, [tj]sconfig.json, *.js
  • Objective-C - *.{m,h}
  • OCaml - *.{ml,eliom,eliomi,ml4,mli,mll,mly}
  • Opa - *.opa
  • OpenCart
  • OracleForms
  • Packer
  • Perl - *.{pl,al,cgi,fcgi,perl,ph,plx,pm,pod,psgi,t}
  • Phalcon
  • PlayFramework
  • Plone
  • Prestashop
  • Processing - *.pde
  • PureScript
  • Python - *.{py,bzl,cgi,fcgi,gyp,lmi,pyde,pyp,pyt,pyw,rpy,tac,wsgi,xpy}
  • Qooxdoo
  • Qt
  • R - *.{r,rd,rsx}
  • Racket - *.{rkt,rktd,rktl,scrbl}
  • Rails - bin/rails, config/boot.rb
  • Raku
  • RhodesRhomobile
  • ROS
  • Ruby - *.{rb,builder,fcgi,gemspec,god,irbrc,jbuilder,mspec,pluginspec,podspec,rabl,rake,rbuild,rbw,rbx,ru,ruby,thor,watchr}, Gemfile
  • Rust - *.{rs,rs.in}
  • Sass - *.sass
  • Scala - *.{scala,sbt,sc}
  • Scheme - *.{scm,sld,sls,sps,ss}
  • SCons
  • Scrivener
  • Sdcc
  • SeamGen
  • SketchUp
  • Smalltalk - *.{st,cs}
  • Stella
  • SugarCRM
  • Swift - *.swift
  • Symfony
  • SymphonyCMS
  • Terraform
  • TeX - *.{tex,aux,bbx,bib,cbx,cls,dtx,ins,lbx,ltx,mkii,mkiv,mkvi,sty,toc}
  • Textpattern
  • TurboGears2
  • TwinCAT3
  • Typo3
  • Unity - *.unity
  • UnrealEngine - *.uproject
  • VisualStudio
  • VVVV
  • Waf
  • WordPress
  • Xojo - *.{xojo_code,xojo_menu,xojo_report,xojo_script,xojo_toolbar,xojo_window}
  • Yeoman
  • Yii
  • ZendFramework
  • Zephir - *.zep

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.