Pygments

generic syntax highlighter


Ticket #372 (closed enhancement: fixed)

Opened 22 months ago

Last modified 22 months ago

Command line argument to determine lexer based on filename only

Reported by: JakeWharton Owned by: gbrandl
Priority: minor Milestone: 1.0
Component: other Keywords:
Cc:

Description

I'd like pygments to attempt to determine a lexer based only on the filename via the command line. This is useful when the filename is known as well as the contents but the file does not actually exist on disk anywhere.

[masseria]$ ./pygmentize -N test.py
python
[masseria]$ ./pygmentize -N test.java
java
[masseria]$ ./pygmentize -N test.sh
bash
[masseria]$ ./pygmentize -N test.klajdfklj
text

I've included a patch to add this functionality.

Attachments

pygments-lexer_guess.patch (1.9 kB) - added by JakeWharton 22 months ago.

Change History

Changed 22 months ago by JakeWharton

Changed 22 months ago by gbrandl

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to 1.0

Thanks, added in [c97ce1d7c205].

Note: See TracTickets for help on using tickets.