diff options
author | CoprDistGit <infra@openeuler.org> | 2023-05-10 09:33:02 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 09:33:02 +0000 |
commit | 44a50562e19758c601fc92e5a04a88b30be48129 (patch) | |
tree | 601cecdd08e1c860a5188757b94a687cc2627711 | |
parent | e86d4098c9c0d6c996dec90f78818f8ab8e9fff6 (diff) |
automatic import of python-chromaterm
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-chromaterm.spec | 569 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 571 insertions, 0 deletions
@@ -0,0 +1 @@ +/chromaterm-0.10.7.tar.gz diff --git a/python-chromaterm.spec b/python-chromaterm.spec new file mode 100644 index 0000000..02296e8 --- /dev/null +++ b/python-chromaterm.spec @@ -0,0 +1,569 @@ +%global _empty_manifest_terminate_build 0 +Name: python-chromaterm +Version: 0.10.7 +Release: 1 +Summary: Color your Terminal with Regex! +License: MIT +URL: https://github.com/hSaria/ChromaTerm +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/6a/bf/01299628cca998dbe8dfd397121e38ead219814b8ed1dc32e8c173b5b7bb/chromaterm-0.10.7.tar.gz +BuildArch: noarch + +Requires: python3-psutil +Requires: python3-PyYAML + +%description +# ChromaTerm + +[](https://github.com/hSaria/ChromaTerm/actions?query=workflow%3ACI) +[](https://coveralls.io/github/hSaria/ChromaTerm) +[](https://pepy.tech/project/chromaterm) +[](https://codeclimate.com/github/hSaria/ChromaTerm) +[](https://badge.fury.io/py/chromaterm) + +ChromaTerm (`ct`) is a Python script that colors your terminal's output using +regular expressions. It even works with interactive programs, like SSH. + + + +## Installation + +```shell +pip3 install chromaterm +``` + +## Usage + +Prefix your command with `ct`. It's that simple. + +```shell +ct ssh somewhere +``` + +You can also pipe data into `ct`, but some programs behave differently when piped, +like `less` would output the entire file. + +```shell +echo "Jul 14 12:28:19 Message from 1.2.3.4: Completed successfully" | ct +``` + +### Persistence + +To always highlight a program, set up an alias in your `.bash_profile`. For +instance, here's one for `ssh`. + +```shell +alias ssh="ct ssh" +``` + +If you want to highlight your entire terminal, have ChromaTerm spawn your shell by +modifying the shell command in your terminal's settings to `/usr/local/bin/ct /bin/bash --login`. +Replace `/bin/bash` with your shell of choice. + +## Highlight Rules + +ChromaTerm reads highlight rules from a YAML configuration file, formatted like so: + +```yaml +rules: +- description: Obligatory "Hello, World" + regex: Hello,?\s+World + color: f#ff0000 + +- description: Spit some facts (emphasize "NOT" so they get it) + regex: Pineapple does (NOT) belong on pizza + color: + 0: bold + 1: blink italic underline +``` + +The configuration file can be placed in one of the locations below. The first one +found is used. + + * `$HOME/.chromaterm.yml` + * `$XDG_CONFIG_HOME/chromaterm/chromaterm.yml` (`$XDG_CONFIG_HOME` defaults to + `$HOME/.config`) + * `/etc/chromaterm/chromaterm.yml` + +If no file is found, a default one is created in your home directory. + +> Check out [`contrib/rules`](https://github.com/hSaria/ChromaTerm/tree/main/contrib/rules); +> it has some topic-specific rules that are not included in the defaults. + +### Description + +Optional. It's purely for your sake. + +### RegEx + +The RegEx engine used is Python's [re](https://docs.python.org/3/library/re.html), +but it can be switched to PCRE2 (see relevant section below). + +### Color + +#### Background and Foreground + +The color is a hex string prefixed by `b` for background (e.g. `b#123456`) and +`f` for foreground (e.g. `f#abcdef`). + +#### Style + +In addition to the background and foreground, you can also use `blink`, `bold`, +`invert`, `italic`, `strike`, and `underline`. Though, not all terminals support +those styles; you might not see their effects. + +### Group + +Colors can be applied per RegEx group (see the 2nd example rule). Any group in +the RegEx can be referenced, including group `0` (entire match) and +[named groups](https://docs.python.org/3/howto/regex.html#non-capturing-and-named-groups). + +### Exclusive + +When multiple rules match the same text, ChromaTerm highlights the text with all +of the colors of the matching rules. If you want the text to be highlighted only +by the first rule that matches it, use the `exclusive` flag. + +```yaml +- regex: hello + color: bold + exclusive: true +``` + +In the code above, no other rule will highlight `hello`, unless it comes first +and has the `exclusive` flag set. + +## Palette + +You can define colors in a palette and reference them by name. For instance: + +```yaml +palette: + # Created from https://coolors.co/9140f5-bd5df6-e879f6 + purple-1: '#9140f5' + purple-2: '#bd5df6' + purple-3: '#e879f6' + +rules: +- regex: hello + color: f.purple-1 + +- regex: hi + color: b.purple-3 +``` + +When referencing a palette color, prefix it with `b.` for background and `f.` for +foreground. + +## PCRE2 + +If the `PCRE2` library is present, you can use it instead of Python's `re` +engine. When present, an option in `ct -h` becomes available. + +While the performance improvement is significant (~2x), the two RegEx engines +have a few differences; use this option only if you have a good understanding +of their unique features. + +> The default rules work on both engines. + +## Help + +If you've got any questions or suggestions, please open up an +[issue](https://github.com/hSaria/ChromaTerm/issues/new/choose) (always +appreciated). + +### Windows support + +To use ChromaTerm on Windows, you will need to run it with the +[Windows Subsystem for Linux (`WSL`)](https://docs.microsoft.com/en-us/windows/wsl/about) + + + + +%package -n python3-chromaterm +Summary: Color your Terminal with Regex! +Provides: python-chromaterm +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-chromaterm +# ChromaTerm + +[](https://github.com/hSaria/ChromaTerm/actions?query=workflow%3ACI) +[](https://coveralls.io/github/hSaria/ChromaTerm) +[](https://pepy.tech/project/chromaterm) +[](https://codeclimate.com/github/hSaria/ChromaTerm) +[](https://badge.fury.io/py/chromaterm) + +ChromaTerm (`ct`) is a Python script that colors your terminal's output using +regular expressions. It even works with interactive programs, like SSH. + + + +## Installation + +```shell +pip3 install chromaterm +``` + +## Usage + +Prefix your command with `ct`. It's that simple. + +```shell +ct ssh somewhere +``` + +You can also pipe data into `ct`, but some programs behave differently when piped, +like `less` would output the entire file. + +```shell +echo "Jul 14 12:28:19 Message from 1.2.3.4: Completed successfully" | ct +``` + +### Persistence + +To always highlight a program, set up an alias in your `.bash_profile`. For +instance, here's one for `ssh`. + +```shell +alias ssh="ct ssh" +``` + +If you want to highlight your entire terminal, have ChromaTerm spawn your shell by +modifying the shell command in your terminal's settings to `/usr/local/bin/ct /bin/bash --login`. +Replace `/bin/bash` with your shell of choice. + +## Highlight Rules + +ChromaTerm reads highlight rules from a YAML configuration file, formatted like so: + +```yaml +rules: +- description: Obligatory "Hello, World" + regex: Hello,?\s+World + color: f#ff0000 + +- description: Spit some facts (emphasize "NOT" so they get it) + regex: Pineapple does (NOT) belong on pizza + color: + 0: bold + 1: blink italic underline +``` + +The configuration file can be placed in one of the locations below. The first one +found is used. + + * `$HOME/.chromaterm.yml` + * `$XDG_CONFIG_HOME/chromaterm/chromaterm.yml` (`$XDG_CONFIG_HOME` defaults to + `$HOME/.config`) + * `/etc/chromaterm/chromaterm.yml` + +If no file is found, a default one is created in your home directory. + +> Check out [`contrib/rules`](https://github.com/hSaria/ChromaTerm/tree/main/contrib/rules); +> it has some topic-specific rules that are not included in the defaults. + +### Description + +Optional. It's purely for your sake. + +### RegEx + +The RegEx engine used is Python's [re](https://docs.python.org/3/library/re.html), +but it can be switched to PCRE2 (see relevant section below). + +### Color + +#### Background and Foreground + +The color is a hex string prefixed by `b` for background (e.g. `b#123456`) and +`f` for foreground (e.g. `f#abcdef`). + +#### Style + +In addition to the background and foreground, you can also use `blink`, `bold`, +`invert`, `italic`, `strike`, and `underline`. Though, not all terminals support +those styles; you might not see their effects. + +### Group + +Colors can be applied per RegEx group (see the 2nd example rule). Any group in +the RegEx can be referenced, including group `0` (entire match) and +[named groups](https://docs.python.org/3/howto/regex.html#non-capturing-and-named-groups). + +### Exclusive + +When multiple rules match the same text, ChromaTerm highlights the text with all +of the colors of the matching rules. If you want the text to be highlighted only +by the first rule that matches it, use the `exclusive` flag. + +```yaml +- regex: hello + color: bold + exclusive: true +``` + +In the code above, no other rule will highlight `hello`, unless it comes first +and has the `exclusive` flag set. + +## Palette + +You can define colors in a palette and reference them by name. For instance: + +```yaml +palette: + # Created from https://coolors.co/9140f5-bd5df6-e879f6 + purple-1: '#9140f5' + purple-2: '#bd5df6' + purple-3: '#e879f6' + +rules: +- regex: hello + color: f.purple-1 + +- regex: hi + color: b.purple-3 +``` + +When referencing a palette color, prefix it with `b.` for background and `f.` for +foreground. + +## PCRE2 + +If the `PCRE2` library is present, you can use it instead of Python's `re` +engine. When present, an option in `ct -h` becomes available. + +While the performance improvement is significant (~2x), the two RegEx engines +have a few differences; use this option only if you have a good understanding +of their unique features. + +> The default rules work on both engines. + +## Help + +If you've got any questions or suggestions, please open up an +[issue](https://github.com/hSaria/ChromaTerm/issues/new/choose) (always +appreciated). + +### Windows support + +To use ChromaTerm on Windows, you will need to run it with the +[Windows Subsystem for Linux (`WSL`)](https://docs.microsoft.com/en-us/windows/wsl/about) + + + + +%package help +Summary: Development documents and examples for chromaterm +Provides: python3-chromaterm-doc +%description help +# ChromaTerm + +[](https://github.com/hSaria/ChromaTerm/actions?query=workflow%3ACI) +[](https://coveralls.io/github/hSaria/ChromaTerm) +[](https://pepy.tech/project/chromaterm) +[](https://codeclimate.com/github/hSaria/ChromaTerm) +[](https://badge.fury.io/py/chromaterm) + +ChromaTerm (`ct`) is a Python script that colors your terminal's output using +regular expressions. It even works with interactive programs, like SSH. + + + +## Installation + +```shell +pip3 install chromaterm +``` + +## Usage + +Prefix your command with `ct`. It's that simple. + +```shell +ct ssh somewhere +``` + +You can also pipe data into `ct`, but some programs behave differently when piped, +like `less` would output the entire file. + +```shell +echo "Jul 14 12:28:19 Message from 1.2.3.4: Completed successfully" | ct +``` + +### Persistence + +To always highlight a program, set up an alias in your `.bash_profile`. For +instance, here's one for `ssh`. + +```shell +alias ssh="ct ssh" +``` + +If you want to highlight your entire terminal, have ChromaTerm spawn your shell by +modifying the shell command in your terminal's settings to `/usr/local/bin/ct /bin/bash --login`. +Replace `/bin/bash` with your shell of choice. + +## Highlight Rules + +ChromaTerm reads highlight rules from a YAML configuration file, formatted like so: + +```yaml +rules: +- description: Obligatory "Hello, World" + regex: Hello,?\s+World + color: f#ff0000 + +- description: Spit some facts (emphasize "NOT" so they get it) + regex: Pineapple does (NOT) belong on pizza + color: + 0: bold + 1: blink italic underline +``` + +The configuration file can be placed in one of the locations below. The first one +found is used. + + * `$HOME/.chromaterm.yml` + * `$XDG_CONFIG_HOME/chromaterm/chromaterm.yml` (`$XDG_CONFIG_HOME` defaults to + `$HOME/.config`) + * `/etc/chromaterm/chromaterm.yml` + +If no file is found, a default one is created in your home directory. + +> Check out [`contrib/rules`](https://github.com/hSaria/ChromaTerm/tree/main/contrib/rules); +> it has some topic-specific rules that are not included in the defaults. + +### Description + +Optional. It's purely for your sake. + +### RegEx + +The RegEx engine used is Python's [re](https://docs.python.org/3/library/re.html), +but it can be switched to PCRE2 (see relevant section below). + +### Color + +#### Background and Foreground + +The color is a hex string prefixed by `b` for background (e.g. `b#123456`) and +`f` for foreground (e.g. `f#abcdef`). + +#### Style + +In addition to the background and foreground, you can also use `blink`, `bold`, +`invert`, `italic`, `strike`, and `underline`. Though, not all terminals support +those styles; you might not see their effects. + +### Group + +Colors can be applied per RegEx group (see the 2nd example rule). Any group in +the RegEx can be referenced, including group `0` (entire match) and +[named groups](https://docs.python.org/3/howto/regex.html#non-capturing-and-named-groups). + +### Exclusive + +When multiple rules match the same text, ChromaTerm highlights the text with all +of the colors of the matching rules. If you want the text to be highlighted only +by the first rule that matches it, use the `exclusive` flag. + +```yaml +- regex: hello + color: bold + exclusive: true +``` + +In the code above, no other rule will highlight `hello`, unless it comes first +and has the `exclusive` flag set. + +## Palette + +You can define colors in a palette and reference them by name. For instance: + +```yaml +palette: + # Created from https://coolors.co/9140f5-bd5df6-e879f6 + purple-1: '#9140f5' + purple-2: '#bd5df6' + purple-3: '#e879f6' + +rules: +- regex: hello + color: f.purple-1 + +- regex: hi + color: b.purple-3 +``` + +When referencing a palette color, prefix it with `b.` for background and `f.` for +foreground. + +## PCRE2 + +If the `PCRE2` library is present, you can use it instead of Python's `re` +engine. When present, an option in `ct -h` becomes available. + +While the performance improvement is significant (~2x), the two RegEx engines +have a few differences; use this option only if you have a good understanding +of their unique features. + +> The default rules work on both engines. + +## Help + +If you've got any questions or suggestions, please open up an +[issue](https://github.com/hSaria/ChromaTerm/issues/new/choose) (always +appreciated). + +### Windows support + +To use ChromaTerm on Windows, you will need to run it with the +[Windows Subsystem for Linux (`WSL`)](https://docs.microsoft.com/en-us/windows/wsl/about) + + + + +%prep +%autosetup -n chromaterm-0.10.7 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-chromaterm -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 0.10.7-1 +- Package Spec generated @@ -0,0 +1 @@ +050dcc214898d0b58b44ef77701ecbd8 chromaterm-0.10.7.tar.gz |