beyondgrep / ack2

**ack 2 is no longer being maintained. ack 3 is the latest version.**
https://github.com/beyondgrep/ack3/
Other
1.48k stars 140 forks source link

Command line options should override .ackrc #246

Closed larryl closed 11 years ago

larryl commented 11 years ago

If you have a --nofoo (or --type=nofoo) in your .ackrc, and then specify --foo on the command line, then the --foo should override the --nofoo (or --type=nofoo).

https://groups.google.com/d/msg/ack-users/0AnO54l2glg/qYnp2TOYYegJ

petdance commented 11 years ago

Do you have a simple test case that this fails under? And can you please provide the results of an ack --dump?

larryl commented 11 years ago

$ mv ~/.ackrc ~/.ackrc-save $ mkdir foo $ cd foo $ echo hello > a.html

$ ack hello # expect some output a.html 1:hello

$ echo '--nohtml' > ~/.ackrc $ ack hello # expect no output $ ack --html hello # expect some output $ ack --type=html hello # expect some output

$ echo '--type=nohtml' > ~/.ackrc $ ack hello # expect no output $ ack --html hello # expect some output $ ack --type=html hello # expect some output

$ ack --dump Unknown type 'html' at /usr/lib/perl5/5.10.0/Getopt/Long.pm line 583

Defaults

--ignore-directory=is:.bzr --ignore-directory=is:.cdv --ignore-directory=is:.git --ignore-directory=is:.hg --ignore-directory=is:.pc --ignore-directory=is:.svn --ignore-directory=is:CVS --ignore-directory=is:RCS --ignore-directory=is:SCCS --ignore-directory=is:_MTN --ignore-directory=is:_build --ignore-directory=is:_darcs --ignore-directory=is:_sgbak --ignore-directory=is:autom4te.cache --ignore-directory=is:blib --ignore-directory=is:coverdb --ignore-directory=is:~.dep --ignore-directory=is:~.dot --ignore-directory=is:~.nib --ignore-directory=is:~.plst --ignore-file=ext:bak --ignore-file=match:/[.]min[.]js$/ --ignore-file=match:/[.]..swp$/ --ignore-file=match:/^#.+#$/ --ignore-file=match:/core.\d+$/ --ignore-file=match:/~$/ --type-add=actionscript:ext:as,mxml --type-add=ada:ext:ada,adb,ads --type-add=asm:ext:asm,s --type-add=asp:ext:asp --type-add=aspx:ext:master,ascx,asmx,aspx,svc --type-add=batch:ext:bat,cmd --type-add=cc:ext:c,h,xs --type-add=cfmx:ext:cfc,cfm,cfml --type-add=clojure:ext:clj --type-add=cmake:ext:cmake --type-add=cmake:is:CMakeLists.txt --type-add=cpp:ext:cpp,cc,cxx,m,hpp,hh,h,hxx --type-add=csharp:ext:cs --type-add=css:ext:css --type-add=delphi:ext:pas,int,dfm,nfm,dof,dpk,dproj,groupproj,bdsgroup,bdsproj --type-add=elisp:ext:el --type-add=erlang:ext:erl,hrl --type-add=fortran:ext:f,f77,f90,f95,f03,for,ftn,fpp --type-add=go:ext:go --type-add=groovy:ext:groovy,gtmpl,gpp,grunit,gradle --type-add=haskell:ext:hs,lhs --type-add=hh:ext:h --type-add=html:ext:htm,html --type-add=java:ext:java,properties --type-add=js:ext:js --type-add=jsp:ext:jsp,jspx,jhtm,jhtml --type-add=lisp:ext:lisp,lsp --type-add=lua:ext:lua --type-add=make:ext:mak --type-add=make:ext:mk --type-add=make:is:GNUmakefile --type-add=make:is:Makefile --type-add=make:is:makefile --type-add=objc:ext:m,h --type-add=objcpp:ext:mm,h --type-add=ocaml:ext:ml,mli --type-add=parrot:ext:pir,pasm,pmc,ops,pod,pg,tg --type-add=perl:ext:pl,pm,pod,t --type-add=perl:firstlinematch:/^#!.\bperl/ --type-add=php:ext:php,phpt,php3,php4,php5,phtml --type-add=php:firstlinematch:/^#!.\bphp/ --type-add=plone:ext:pt,cpt,metadata,cpy,py --type-add=python:ext:py --type-add=python:firstlinematch:/^#!.\bpython/ --type-add=rake:is:Rakefile --type-add=rr:ext:R --type-add=ruby:ext:rb,rhtml,rjs,rxml,erb,rake,spec --type-add=ruby:firstlinematch:/^#!.\bruby/ --type-add=ruby:is:Rakefile --type-add=rust:ext:rs --type-add=scala:ext:scala --type-add=scheme:ext:scm,ss --type-add=shell:ext:sh,bash,csh,tcsh,ksh,zsh --type-add=shell:firstlinematch:/^#!.\b(?:ba|t?c|k|z)?sh\b/ --type-add=smalltalk:ext:st --type-add=sql:ext:sql,ctl --type-add=tcl:ext:tcl,itcl,itk --type-add=tex:ext:tex,cls,sty --type-add=tt:ext:tt,tt2,ttml --type-add=vb:ext:bas,cls,frm,ctl,vb,resx --type-add=verilog:ext:v,vh,sv --type-add=vhdl:ext:vhd,vhdl --type-add=vim:ext:vim --type-add=xml:ext:xml,dtd,xsl,xslt,ent --type-add=xml:firstlinematch:/<[?]xml/ --type-add=yaml:ext:yaml,yml

/home/larryl/.ackrc

--type=nohtml