summaryrefslogtreecommitdiff
path: root/pygments/cmdline.py
Commit message (Collapse)AuthorAgeFilesLines
* cmdline: port to argparse (#1693)Georg Brandl2021-01-301-163/+168
| | | | | | | | | | | | * cmdline: port to argparse * cmdline: adapt the argparse help formatter to actually take terminal width into account * Update based on review feedback. * Extract "is_only_option" method * Check -L argument to be a "known good" argument Co-authored-by: Matthäus G. Chajdas <dev@anteru.net>
* Run pyupgrade across codebase to modernize syntax and patterns (#1622)Jon Dufresne2021-01-171-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | pyupgrade is a tool to automatically upgrade syntax for newer versions of the Python language. The project has been Python 3 only since 35544e2fc6eed0ce4a27ec7285aac71ff0ddc473, allowing for several cleanups: - Remove unnecessary "-*- coding: utf-8 -*-" cookie. Python 3 reads all source files as utf-8 by default. - Replace IOError/EnvironmentError with OSError. Python 3 unified these exceptions. The old names are aliases only. - Use the Python 3 shorter super() syntax. - Remove "utf8" argument form encode/decode. In Python 3, this value is the default. - Remove "r" from open() calls. In Python 3, this value is the default. - Remove u prefix from Unicode strings. In Python 3, all strings are Unicode. - Replace io.open() with builtin open(). In Python 3, these functions are functionally equivalent. Co-authored-by: Matthäus G. Chajdas <Anteru@users.noreply.github.com>
* Added `pygmentize -C` option to guess a lexer from contentGeorg Brandl2021-01-171-2/+18
|
* Bump copyright year.Matthäus G. Chajdas2021-01-031-2/+2
|
* Fix a Windows/PyPy3 test failure (#1533)Kurt McKee2020-09-071-1/+8
| | | | | | | PyPy3 on Windows has a test failure in `test_cmdline:test_outfile()` when trying to unlink the temporary output file. The root cause is that `cmdline:inner_main()` does not explicitly close the file that it opens, and PyPy3 isn't auto-closing the file when `inner_main()` returns. This prevents the file from being unlinked, and the test case fails.
* Update copyright year (fixes #1514.)Matthäus G. Chajdas2020-08-221-2/+2
|
* Fix tests on Windows.Matthäus G. Chajdas2020-03-011-3/+20
| | | | | | | This fixes three test failures on Windows: * Two due to incorrect handling of : (on Windows, multiple : can be part of a path.) * One due to newline differences
* Remove Python 2 compatibility (#1348)Georg Brandl2020-02-291-22/+7
| | | | | | | | | | | * Remove Python 2 compatibility * remove 2/3 shims in pygments.util * update setup.py metadata * Remove unneeded object inheritance. * Remove unneeded future imports.
* Update hg/bitbucket -> git/github everywhere.Georg Brandl2019-11-101-1/+1
|
* Fixup all headers and some more minor problems.2.4.2Georg Brandl2019-05-281-2/+2
|
* Merged in xuhdev/pygments-main/terminal256 (pull request #666)Georg Brandl2017-01-271-16/+55
|\ | | | | | | When no output file is specified, use the "terminal256" formatter by default if TERM contains "256".
| * -x functionality updates, Python 3 compatibility fixGeorg Brandl2017-01-221-1/+1
| |
| * Merged in tprynn/pygments-main/command-line-lexer-formatter (pull request #559)Georg Brandl2017-01-221-2/+2
| |\ | | | | | | | | | Custom Lexer/Formatter File Loading
| | * Copyright update.Georg Brandl2017-01-221-2/+2
| | |
| | * Add support for partials and path segments for Handlebars.Christian Hammond2016-11-041-0/+529
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces support for some missing features to the Handlebars lexer: Partials and path segments. Partials mostly appeared to work before, but the `>` in `{{> ... }}` would appear as a syntax error, as could other components of the partial. This change introduces support for: * Standard partials: `{{> partialName}}` * Partials with parameters: `{{> partialName varname="value"}}` * Ddynamic partials: `{{> (partialFunc)}}` * Ddynamic partials with lookups: `{{> (lookup ../path "partialName")}}` * Partial blocks: `{{> @partial-block}}` * Inline partials: `{{#*inline}}..{{/inline}}` It also introduces support for path segments, which can reference content in the current context or in a parent context. For instance, `this.name`, `this/name`, `./name`, `../name`, `this/name`, etc. These are all now tracked as variables.
| * Update pull request per comments by birkenfeld.Tanner Prynn2016-02-241-32/+27
| | | | | | | | | | | | | | Add optional function parameter for the class name to instantiate, and update cli to support this. Move error handling to within the loading functions; they now only raise ClassNotFound. Modify doc with these updates and the version number. Test case clean up and additions.
| * Add additional command line option to prevent users from using eval() on ↵Tanner Prynn2016-02-221-9/+25
| | | | | | | | | | | | | | | | untrusted files Finish custom-formatter loading and fill in some docstrings Add load_?_from_file functions to API documentation pep8 compliance
| * add basic CLI support for custom lexers/formattersTanner Prynn2016-02-221-11/+39
| |
* | Use one single line to condition on whether TERM contains 256.Hong Xu2017-01-261-1/+1
| |
* | When no output file is specified, use the "terminal256" formatter by default ↵Hong Xu2016-09-251-1/+6
|/ | | | if TERM contains "256".
* merge default into stableGeorg Brandl2016-01-171-0/+529