Skip to content

Commit

Permalink
- Print reset sequence as \e[m instead of \e[0m
Browse files Browse the repository at this point in the history
- Added __version__ var
  • Loading branch information
delameter committed Apr 20, 2022
1 parent e5b9cad commit 96bc981
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.dist
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
VERSION=1.7.0
VERSION=1.7.1
PYPI_USERNAME=__token__
PYPI_PASSWORD= #api token
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ set-version: ## Set new package version
if [ ! -f .env ] ; then cp -u .env.dist .env ; fi
sed -E -i "s/^VERSION.+/VERSION=$$VERSION/" .env
sed -E -i "s/^version.+/version = $$VERSION/" setup.cfg
sed -E -i "s/^__version__.+/__version__ = '$$VERSION'/" ${PROJECT_NAME}/__init__.py
echo "Updated version: ${GREEN}$$VERSION${RESET}"

generate-readme: ## Generate README file
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,10 @@ You can of course create your own sequences and formats, but with one limitation

## Changelog

### v1.7.1

- Print reset sequence as `\e[m` instead of `\e[0m`.

### v1.7.0

- `Format()` constructor can be called without arguments.
Expand Down
4 changes: 4 additions & 0 deletions dev/readme/README.tpl.md
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ You can of course create your own sequences and formats, but with one limitation

## Changelog

### v1.7.1

- Print reset sequence as `\e[m` instead of `\e[0m`.

### v1.7.0

- `Format()` constructor can be called without arguments.
Expand Down
1 change: 1 addition & 0 deletions pytermor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
'ReplaceSGR',
'ReplaceNonAsciiBytes',
]
__version__ = '1.7.1'
7 changes: 6 additions & 1 deletion pytermor/seq.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,14 @@ class SequenceSGR(AbstractSequenceCSI, metaclass=ABCMeta):
def print(self) -> str:
if len(self._params) == 0:
return ''

params = self._params
if params == [0]: # \e[0m <=> \em, saving 1 byte
params = []

return f'{self.CONTROL_CHARACTER}' \
f'{self.INTRODUCER}' \
f'{self.SEPARATOR.join([str(param) for param in self._params])}' \
f'{self.SEPARATOR.join([str(param) for param in params])}' \
f'{self.TERMINATOR}'

def __add__(self, other: SequenceSGR) -> SequenceSGR:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = pytermor
version = 1.7.0
version = 1.7.1
author = Aleksandr Shavykin
author_email = 0.delameter@gmail.com
description = ANSI formatted terminal output library
Expand Down

0 comments on commit 96bc981

Please sign in to comment.