Skip to content

Commit abe33a4

Browse files
Merge pull request #30 from Mr-Sunglasses/feat/functional
2 parents ad84e57 + 6c71eac commit abe33a4

File tree

13 files changed

+146
-115
lines changed

13 files changed

+146
-115
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: CI Pipeline
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Login Dockerhub
15+
env:
16+
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
17+
DOCKER_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
18+
run: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
19+
20+
- name: Build the Docker image
21+
run: docker build -t mrsunglasses/bitssh .
22+
- name: Push to Dockerhub
23+
run: docker push mrsunglasses/bitssh:latest

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ on:
77

88
jobs:
99
build:
10-
10+
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
1414
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15-
15+
1616
steps:
1717
- uses: actions/checkout@v4
1818
- name: Set up Python ${{ matrix.python-version }}
@@ -22,6 +22,6 @@ jobs:
2222
- name: Create config mock
2323
run: mkdir ~/.ssh && touch ~/.ssh/config
2424
- name: Install dependencies
25-
run: pip3 install . && pip3 install pytest
25+
run: pip3 install -e . && pip3 install pytest
2626
- name: Run Test
27-
run: pytest
27+
run: pytest

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ RUN python -m pip install --upgrade pip
1313
RUN pip install bitssh
1414

1515
# Command to run when container starts
16-
CMD ["bitssh"]
16+
CMD ["bitssh"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Install from source
4343

4444
cd bitssh
4545

46-
python3 -m pip3 install .
46+
python3 -m pip3 install -e .
4747

4848
bitssh
4949
```

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
[build-system]
2-
requires = ["setuptools>=61.0.0", "wheel"]
2+
requires = ["setuptools>=80.9.0", "wheel"]
33
build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "bitssh"
7-
version = "3.0.0"
7+
version = "3.1.0"
88
description = "A New and Modern SSH connector written in Python."
99
readme = "README.md"
1010
authors = [
@@ -23,7 +23,7 @@ classifiers = [ # List of https://pypi.org/classifiers/
2323
]
2424
keywords = ["bitssh", "sshmanager", "commandline"]
2525
dependencies = [
26-
"rich",
26+
"rich>=14.0.0",
2727
"pre-commit>=3.6.0",
2828
"path>=16.9.0",
2929
"InquirerPy>=0.3.4",
@@ -41,7 +41,7 @@ Docs = "https://github.com/Mr-Sunglasses/bitssh/blob/master/docs/docs.md"
4141
bitssh = "bitssh.__main__:main"
4242

4343
[tool.bumpver]
44-
current_version = "3.0.0"
44+
current_version = "3.1.0"
4545
version_pattern = "MAJOR.MINOR.PATCH"
4646
commit_message = "Bump version {old_version} -> {new_version}"
4747
commit = true

setup.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/bitssh/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
pass
66

77

8-
__version__ = "3.0.0"
8+
__version__ = "3.1.0"

src/bitssh/argument_parser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def __init__(self) -> None:
88
)
99
parser.add_argument(
1010
"--version",
11+
"-v",
1112
action="store_true",
1213
default=False,
1314
help="Show the bitssh version.",

src/bitssh/cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import os
2-
31
from bitssh import __version__
42

53
from .argument_parser import Config

src/bitssh/prompt.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
import os
2+
import subprocess
23
from typing import Dict, List, Optional
34

45
from InquirerPy import inquirer
56

67
from .ui import console
7-
from .utils import ConfigPathUtility
8+
from .utils import get_config_file_host_data
89

910

1011
def ask_host_prompt():
11-
HOST: List[str] = ConfigPathUtility.get_config_file_host_data()
12-
questions: List[List] = inquirer.fuzzy(
12+
HOST: List[str] = get_config_file_host_data()
13+
questions = inquirer.fuzzy(
1314
message="Select the Host Given in the Above List: ",
1415
choices=HOST,
1516
)
1617
try:
17-
answers: Optional[Dict[str, str]] = questions.execute()
18+
answers = questions.execute()
1819
if answers is None:
1920
return
2021

2122
cmd: str = answers
22-
cmd = cmd[7::]
23-
cmd = f"ssh {cmd}"
24-
os.system("cls" if os.name == "nt" else "clear")
23+
try:
24+
_cmd_exec_data = cmd.split("-> ")[1] # clean the data from answers
25+
except IndexError:
26+
raise ValueError("Invalid format: expected '-> ' delimiter in the answer.")
27+
if os.name == "nt": # Windows
28+
subprocess.run(["cls"], shell=True, check=True)
29+
else: # Unix-like systems
30+
subprocess.run(["clear"], check=True)
2531
console.print(
2632
"Please Wait While Your System is Connecting to the Remote Server 🖥️",
2733
style="green",
2834
)
29-
os.system(cmd)
35+
subprocess.run(["ssh", _cmd_exec_data], check=True)
36+
except subprocess.CalledProcessError as e:
37+
print(f"Error: {e.stdout}")
3038
except Exception as Error:
3139
print(f"\nInterrupted by {Error}")

0 commit comments

Comments
 (0)