Skip to content

Instantly share code, notes, and snippets.

@swiftycode256
Last active July 11, 2025 03:52
Show Gist options
  • Select an option

  • Save swiftycode256/bb6f8e245d9f1246a7474e6055b2c2aa to your computer and use it in GitHub Desktop.

Select an option

Save swiftycode256/bb6f8e245d9f1246a7474e6055b2c2aa to your computer and use it in GitHub Desktop.
!require_version 2.0-beta3
# How to use (Windows not currently supported):
# - Install CLItheme by following instructions in README:
# https://github.com/swiftycode256/clitheme/
# - Make necessary changes to this file, and use the following command to apply the ruleset
# clitheme apply-theme <file path> or
# python3 -m clitheme apply-theme <file path>
# (Drag file to terminal window to obtain file path)
# - Use `clitheme-exec` to execute the program
# clitheme-exec python3 or
# python3 -m clitheme.exec python3
# (For more available commands, please run `clitheme --help`)
{header_section}
# **UNCOMMENT the name entry and change the name**
# name [**NAME HERE**]
[description]
[**YOUR DESCRIPTION HERE**]
[/description]
supported_apps python3
{/header_section}
{substrules_section}
set_options substvar substesc
setvar:locale default
setvar:escseq ({{ESC}}[\[\(\]\)][\d\?;]*?[a-zA-Z]|{{ESC}}.)
# **Make sure you use these commands for the ruleset to trigger**
[filter_commands]
python
python3
[/filter_commands]
# **All regex and substitute patterns use Python's re module syntax (https://docs.python.org/3/howto/regex.html)**
# **To enable a ruleset, remove the hashtag (#) in front of the "locale:" line**
# **When editing the substitution content, PRESERVE all groups (\g<[name]>) and variables ({{[name]}})**
# Note: Use two backslashes (\\) to represent one backslash
# (Tip: Copy the line and make changes and uncomment that instead to make things easier)
setvar:ep {{escseq}}*
setvar:ep1 (?P<c1>{{ep}})
setvar:ep2 (?P<c2>{{ep}})
setvar:ep3 (?P<c3>{{ep}})
setvar:ep4 (?P<c4>{{ep}})
setvar:ep5 (?P<c5>{{ep}})
setvar:ep6 (?P<c6>{{ep}})
setvar:: {{ep2}}: {{ep3}}
setvar:col \g<c2>:\g<c3>
# **"{{msgclr}}" is a version of "{{col}}" without the colon in between**
setvar:msgclr \g<c2>\g<c3>
[subst_regex] ^Type "help", "copyright", "credits" or "license" for more information\.
# locale:{{locale}} Type "help", "copyright", "credits" or "license" for more information.
[/subst_regex]
[subst_regex] ^(?P<esc>{{ep}})Traceback \(most recent call last\):
# locale:{{locale}} \g<esc>Traceback (most recent call last):
[/subst_regex]
# e.g. File "<stdin>", line 1, in <module>
[subst_regex] ^(?P<spc>{{ep}}[ ]{2})File {{ep1}}\"(?P<filename>.+)\"{{ep2}}, line {{ep3}}(?P<line>\d+){{ep4}}, in {{ep5}}(?P<func>[^{{ESC}}\r\n]+){{ep6}}
# locale:{{locale}} \g<spc>File \g<c1>"\g<filename>"\g<c2>, line \g<c3>\g<line>\g<c4>, in \g<c5>\g<func>\g<c6>
[/subst_regex]
[subst_regex] ^(?P<spc>{{ep}}[ ]{2})File {{ep1}}\"(?P<filename>.+)\"{{ep2}}, line {{ep3}}(?P<line>\d+){{ep4}}
# locale:{{locale}} ^\g<spc>File \g<c1>"\g<filename>"\g<c2>, line \g<c3>\g<line>\g<c4>
[/subst_regex]
[subst_regex] ^{{ep1}}SyntaxError{{:}}invalid syntax\. Perhaps you forgot a comma\?
# locale:{{locale}} \g<c1>SyntaxError{{col}} invalid syntax. Perhaps you forgot a comma?
[/subst_regex]
[subst_regex] ^{{ep1}}SyntaxError{{:}}invalid syntax
# locale:{{locale}} \g<c1>SyntaxError{{col}} invalid syntax
[/subst_regex]
[subst_regex] ^{{ep1}}SyntaxError{{:}}Did you mean to use 'from \.\.\. import \.\.\.' instead\?
# locale:{{locale}} \g<c1>SyntaxError{{col}} Did you mean to use 'from ... import ...' instead?
[/subst_regex]
[subst_regex] ^{{ep1}}(?P<error>NameError){{:}}name '(?P<name>.+)' is not defined\. Did you mean: '(?P<name2>.+)'\? Or did you forget to import '(?P<name3>.+)'\?
# locale:{{locale}} \g<c1>\g<error>{{col}} name '\g<name>' is not defined. Did you mean: '\g<name2>'? Or did you forget to import '\g<name3>'?
[/subst_regex]
[subst_regex] ^{{ep1}}(?P<error>NameError){{:}}name '(?P<name>.+)' is not defined\. Did you mean: '(?P<name2>.+)'\?
# locale:{{locale}} \g<c1>\g<error>{{col}} name '\g<name>' is not defined. Did you mean: '\g<name2>'?
[/subst_regex]
[subst_regex] ^{{ep1}}(?P<error>NameError){{:}}name '(?P<name>.+)' is not defined\. Did you forget to import '(?P<name2>.+)'\?
# locale:{{locale}} \g<c1>\g<error>{{col}} name '\g<name>' is not defined. Did you forget to import '\g<name2>'?
[/subst_regex]
[subst_regex] ^{{ep1}}(?P<error>KeyError){{:}}(?P<a>')?(?P<name>[^\r\n{{ESC}}]*)(?(a)'|)
[subst_regex] ^{{ep1}}(?P<error>NameError){{:}}name '(?P<name>.+)' is not defined
[subst_regex] ^{{ep1}}(?P<error>ModuleNotFoundError){{:}}No module named '(?P<name>.+)'; '.+' is not a package
[subst_regex] ^{{ep1}}(?P<error>ModuleNotFoundError){{:}}No module named '(?P<name>.+)'
# locale:{{locale}} \g<c1>\g<error>{{col}} Item '\g<name>' cannot be found
[/subst_regex]
[subst_regex] ^{{ep1}}AttributeError{{:}}module '(?P<name1>.+)' has no attribute '(?P<name2>.+)'\. Did you mean: '(?P<name3>.+)'\?
[subst_regex] ^{{ep1}}AttributeError{{:}}'(?P<name1>.+)' object has no attribute '(?P<name2>.+)'\. Did you mean: '(?P<name3>.+)'\?
# locale:{{locale}} \g<c1>AttributeError{{col}} '\g<name1>' has no attribute '\g<name2>'. Did you mean: '\g<name3>'?
[/subst_regex]
[subst_regex] ^{{ep1}}AttributeError{{:}}module '(?P<name1>.+)' has no attribute '(?P<name2>.+)'
[subst_regex] ^{{ep1}}AttributeError{{:}}'(?P<name1>.+)' object has no attribute '(?P<name2>.+)'
# locale:{{locale}} \g<c1>AttributeError{{col}} '\g<name1>' has no attribute '\g<name2>'
[/subst_regex]
[subst_regex] ^{{ep1}}TypeError{{:}}unhashable type: '(?P<name>.+)'
# locale:{{locale}} \g<c1>TypeError{{col}} unhashable type: '\g<name>'
[/subst_regex]
[subst_regex] ^{{ep1}}ZeroDivisionError{{:}}division by zero
# locale:{{locale}} \g<c1>ZeroDivisionError{{col}} division by zero
[/subst_regex]
[subst_regex] ^{{ep1}}IndexError{{:}}(?P<name>\w+) index out of range
# locale:{{locale}} \g<c1>IndexError{{col}} \g<name> index out of range
[/subst_regex]
[subst_regex] ^{{ep1}}IndentationError{{:}}(unexpected indent)
# locale:{{locale}} \g<c1>IndentationError{{col}} unexpected indent
[/subst_regex]
[subst_regex] ^{{ep1}}IndentationError{{:}}expected an indented block after '(?P<name>.+)' statement on line (?P<num>\d+)
# locale:{{locale}} \g<c1>IndentationError{{col}} expected an indented block after '\g<name>' statement on line \g<num>
[/subst_regex]
[subst_regex] ^{{ep1}}IndentationError{{:}}expected an indented block after function definition on line (?P<num>\d+)
# locale:{{locale}} \g<c1>IndentationError{{col}} expected an indented block after function definition on line \g<num>
[/subst_regex]
[subst_regex] ^{{ep1}}IndentationError{{:}}expected an indented block
# locale:{{locale}} \g<c1>IndentationError{{col}} expected an indented block
[/subst_regex]
[subst_regex] ^{{ep1}}TabError{{:}}inconsistent use of tabs and spaces in indentation
# locale:{{locale}} \g<c1>TabError{{col}} inconsistent use of tabs and spaces in indentation
[/subst_regex]
[subst_regex] ^During handling of the above exception, another exception occurred:
# locale:{{locale}} During handling of the above exception, another exception occurred:
[/subst_regex]
[subst_regex] ^{{ep1}}SyntaxError{{:}}leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
# locale:{{locale}} \g<c1>SyntaxError{{col}} leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
[/subst_regex]
{/substrules_section}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment