Comments (7)
My mistake, i did not remember i had added the following to my .ackrc
years ago !
# add TEXT, CSV, etc.
--type-set=txt:ext:txt
--type-set=csv:ext:csv,tdf
which caused ack --help-types
to report txt
from ack3.
RETRACTED
The reason there is no previous issue for txt
as a new filetype for Ack 3.x is that it's been provided since beginning of --type=
type with old Ack1.x .
While using the MIME names plain
and text
might have made some sense, the built-in type for .txt
files is --type=txt
, abbreviated --txt
. This is basically for historical reasons (e.g., ack is about code source files that mostly have extensions, not about Email/HTML MIME types carried by Internet protocols).
While there might be some minor DWIM value in allowing --text
and --type=text
as aliases (heck i've typed that expecting it to work!), there's clearly a simple workaround of using --txt
.
from ack3.
That's strange.
Using ack --help-types
I don't see anything in the output resembling txt, except for CMakeList.txt
, and searching the man page doesn't reveal anything to me either.
When I run ack --txt
or ack --type=txt
I get
ack: Unknown type 'txt'
ack: Invalid option on command line
version:
ack v3.7.0 (standard build)
Running under Perl v5.36.1 at /usr/bin/perl
Copyright 2005-2023 Andy Lester.
Taken from arch repos here: https://archlinux.org/packages/extra/any/ack/
from ack3.
In this context, "text" refers to the content of the file, vs "binary".
For example, a file of Python code may have a .py
extension and can be referenced with the --python
option, but it's also contains plain text.
By default, if you give ack no filenames to search and no type option, like ack whatever
, it will go search for all files that contain text and search those for the string whatever
, regardless of if it matches .txt
or any other extension. ack looks at the content of the file, says "this looks like text and not binary data" and uses that to make its determination. These might be XML files or Markdown files or maybe files with no extension.
My concern is that --text
mapping to .txt
would be confused with the current behavior described above.
Can you tell us more about your use case? Do you use .txt
as an extension for just any file that contains plain text but that isn't something like source code or a formatted data file like JSON or XML?
from ack3.
Do you use .txt as an extension for just any file that contains plain text but that isn't something like source code or a formatted data file like JSON or XML?
Yeah pretty much just this.
from ack3.
Related Issues (20)
- Unicode troubles? HOT 10
- $ not escaped by \Q? HOT 5
- Add .adoc to filetypes HOT 5
- Browsing at root of system resources not allowed HOT 3
- beyondgrep.com SSL certificate expired HOT 2
- Missing extension for R language HOT 3
- Add an option to show first N lines (--head=N) HOT 21
- Add option for color search HOT 2
- Get a new test codebase for timings
- Support ".ps1" PowerShell file type HOT 6
- Request: --no-group-separator option HOT 4
- ack manual ACK COLORS: typing errors `ACK COLOR_LINENO` + `ACK COLOR_COLNO` HOT 5
- Add GN (Generate Ninja) filetype HOT 3
- Add field support (a la Perl) HOT 9
- -x and --type=format options should be mutex HOT 4
- Add a -X that acts like -x but obeys the --type filters HOT 4
- Missing release email for ack v3.7.0 HOT 1
- Please support relative paths in --ignore-dir HOT 1
- Have a --noignore-file option HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ack3.