Skip to content

Commit

Permalink
🐛 merge pull request #2 from juanesarango/patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmedmar authored Mar 25, 2019
2 parents 409a3af + 99a8d62 commit 0e6b2b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions alie/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import json

import click
import slugify

from alie import __version__

Expand Down Expand Up @@ -117,7 +116,7 @@ def main(alias, command, is_function):
Pass no arguments to list aliases. Pass only the `ALIAS` to remove it.
"""
alie = Alie()
alias = slugify.slugify(alias or '', separator='_')
alias = '_'.join((alias or '').split(' '))
colored = click.style(f'{alias}', fg='magenta')

if not alias:
Expand Down
3 changes: 1 addition & 2 deletions setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
"pytest-runner==2.11.1"
],
"install_requires": [
"Click>=6.7",
"python-slugify>=1.0.22"
"Click>=6.7"
],
"extras_require": {
"test": [
Expand Down
11 changes: 8 additions & 3 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
"""alie cli tests."""

from click.testing import CliRunner
from os import environ
import pytest
from click.testing import CliRunner

from alie import cli

Expand All @@ -27,9 +26,15 @@ def test_main(tmpdir):
result = runner.invoke(cli.main, ['hello'])
assert 'not registered' in result.output

params = [f'say', 'echo "$@"', '-f']
params = [f'say-message', 'echo "$@"', '-f']
result = runner.invoke(cli.main, params)
assert 'CREATED' in result.output

params = [f'"clear console"', 'clear']
result = runner.invoke(cli.main, params)
assert 'CREATED' in result.output

result = runner.invoke(cli.main, [])
assert 'function ' in result.output
assert 'say-message' in result.output
assert 'clear_console' in result.output

0 comments on commit 0e6b2b6

Please sign in to comment.