Coder Social home page Coder Social logo

Filetype request: .txt filetype about ack3 HOT 7 OPEN

Miepee avatar Miepee commented on June 11, 2024
Filetype request: .txt filetype

from ack3.

Comments (7)

n1vux avatar n1vux commented on June 11, 2024 1

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.

n1vux avatar n1vux commented on June 11, 2024

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.

Miepee avatar Miepee commented on June 11, 2024

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.

petdance avatar petdance commented on June 11, 2024

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.

Miepee avatar Miepee commented on June 11, 2024

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)

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.