Skip to content

Commit

Permalink
Added type for test parameter in gnu_coreutils.cd()
Browse files Browse the repository at this point in the history
Removed "short_args=" from its tests.
  • Loading branch information
Andrew15-5 committed Jan 21, 2022
1 parent c9a6eac commit 47d8163
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ python3 -m pip install niceshell

```bash
cd /tmp/
version=2.0.0 # Choose desired version
version=2.0.1 # Choose desired version
wget -c "https://github.com/Andrew15-5/niceshell/releases/download/v${version}/niceshell-${version}-py3-none-any.whl"
python3 -m pip -U --user install niceshell-${version}-py3-none-any.whl
```
Expand Down
2 changes: 1 addition & 1 deletion niceshell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"quotes_wrapper", "rm", "shell", "Shell", "ShortArgsOption", "UID",
"USER"]
__author__ = "Andrew Voynov"
__version__ = "2.0.0"
__version__ = "2.0.1"

GID = Shell("id -g").output()[:-1]
GROUP = Shell("id -gn").output()[:-1]
Expand Down
3 changes: 1 addition & 2 deletions niceshell/gnu_coreutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def cd(path: str = '',
path = expose_tilde(quotes_wrapper(path))
path = re.sub(r'(?<=[^\\])\*', '"*"', path) # Expose wildcard (*)
path = re.sub(r'\\\*', '*', path) # Preserve '*'
args = normalize_short_and_long_args(
short_args, [], ShortArgsOption.APART)
args = normalize_short_and_long_args(short_args, [], ShortArgsOption.APART)
command = f"cd {args} -- {path}".strip()
if test:
return command
Expand Down
2 changes: 1 addition & 1 deletion niceshell/gnu_coreutils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from .core import Shell

def cd(path: str = '',
short_args: Union[str, Iterable[str]] = [],
test=False) -> Union[Shell, str]: ...
test: bool = False) -> Union[Shell, str]: ...


def cp(source_path: Union[str, Iterable[str]],
Expand Down
8 changes: 4 additions & 4 deletions niceshell/tests/test_gnu_coreutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ def test_cd(self):

# Asserts
def cd(path: str = '',
short_args: Union[str, Iterable[str]] = []):
short_args: Union[str, Iterable[str]] = []):
return gnu_coreutils.cd(path, short_args, True)
# Test short arguments
assert cd(short_args="-L") == "cd -L --"
assert cd(short_args="Pe") == "cd -P -e --"
assert cd(short_args=['P', 'e', '@']) == "cd -P -e -@ --"
assert cd('', "-L") == "cd -L --"
assert cd('', "Pe") == "cd -P -e --"
assert cd('', ['P', 'e', '@']) == "cd -P -e -@ --"

# Without wildcard
assert cd() == "cd --"
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

setuptools.setup(
name="niceshell",
version="2.0.0",
version="2.0.1",
author="Andrew Voynov",
author_email="[email protected]",
description="Integration of shell and basic GNU core unilities for better coding.",
long_description=long_description,
long_description_content_type="text/markdown",
license="MIT",
url="https://github.com/Andrew15-5/niceshell",
download_url="https://github.com/Andrew15-5/niceshell/releases/download/v2.0.0/niceshell-2.0.0-py3-none-any.whl",
download_url="https://github.com/Andrew15-5/niceshell/releases/download/v2.0.1/niceshell-2.0.1-py3-none-any.whl",
packages=["niceshell", "niceshell/tests"],
package_data={
"niceshell": ['*']
Expand Down

0 comments on commit 47d8163

Please sign in to comment.