diff --git a/.gitignore b/.gitignore index 4660fd5..9de926e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,7 @@ squashfs-root .pytest_cache/ build/ dist/ -xonssh_xxh.egg-info/ +xxh_xxh.egg-info/ venv/ # temporary files from vim and emacs @@ -25,4 +25,4 @@ venv/ .vscode/ # Mac -.DS_Store \ No newline at end of file +.DS_Store diff --git a/README.md b/README.md index 61792b8..ce3309a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@

You chosen a command shell and spent months to stuffed it with shortcuts and colors. But when you move from local to remote host using ssh you lose it all. The mission of xxh is to bring your favorite shell wherever you go through the ssh.

- [release] + [release] [asciinema demo] [plugins] [gitter chat] - [BSD license] + [BSD license]

## Install or update ``` -python3 -m pip install --upgrade xonssh-xxh +python3 -m pip install --upgrade xxh-xxh ``` After install you can just using `xxh` command as replace `ssh` to connecting to the host because `xxh` has seamless support of basic `ssh` command arguments. diff --git a/setup.py b/setup.py index c7f0c3c..8b76556 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,8 @@ import setuptools -from xonssh_xxh.settings import global_settings +from xxh_xxh.settings import global_settings setuptools.setup( - name="xonssh-xxh", + name="xxh-xxh", version=global_settings['XXH_VERSION'], description="xxh is for using portable xonsh shell wherever you go through the ssh", url="https://github.com/xxh/xxh", @@ -19,7 +19,7 @@ setuptools.setup( ], platforms='Unix-like', scripts=['xxh','xxhp','xxh.zsh','xxh.xsh'], - package_data={'xonssh_xxh':['*.xsh', '*.sh']}, + package_data={'xxh_xxh':['*.xsh', '*.sh']}, packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", diff --git a/xxh b/xxh index 1f30d41..169be93 100755 --- a/xxh +++ b/xxh @@ -347,7 +347,7 @@ class Xxh: def main(self): self.create_xxh_env() argp = argparse.ArgumentParser(description=f"Your favorite shell wherever you go through the ssh.\n{self.d2F0Y2ggLW4uMiB4eGggLWg()}", formatter_class=RawTextHelpFormatter, prefix_chars='-+') - argp.add_argument('--version', '-V', action='version', version=f"xonssh-xxh/{self.local_xxh_version}") + argp.add_argument('--version', '-V', action='version', version=f"xxh/{self.local_xxh_version}") argp.add_argument('-p', dest='ssh_port', help="Port to connect to on the remote host.") argp.add_argument('-l', dest='ssh_login', help="Specifies the user to log in as on the remote machine.") argp.add_argument('-i', dest='ssh_private_key', help="File from which the identity (private key) for public key authentication is read.") @@ -674,8 +674,8 @@ if __name__ == '__main__': this_file = __file__ sys.path.append(str(pf"{this_file}".absolute().parent)) - import xonssh_xxh - from xonssh_xxh.settings import global_settings + import xxh_xxh + from xxh_xxh.settings import global_settings - xxh = Xxh(package_dir_path=pf"{xonssh_xxh.__file__}".parent, version=global_settings['XXH_VERSION']) + xxh = Xxh(package_dir_path=pf"{xxh_xxh.__file__}".parent, version=global_settings['XXH_VERSION']) xxh.main() diff --git a/xonssh_xxh/__init__.py b/xxh_xxh/__init__.py similarity index 100% rename from xonssh_xxh/__init__.py rename to xxh_xxh/__init__.py diff --git a/xonssh_xxh/config.xxhc b/xxh_xxh/config.xxhc similarity index 100% rename from xonssh_xxh/config.xxhc rename to xxh_xxh/config.xxhc diff --git a/xonssh_xxh/host_info.sh b/xxh_xxh/host_info.sh similarity index 100% rename from xonssh_xxh/host_info.sh rename to xxh_xxh/host_info.sh diff --git a/xonssh_xxh/settings.py b/xxh_xxh/settings.py similarity index 94% rename from xonssh_xxh/settings.py rename to xxh_xxh/settings.py index 59b3ee3..6443cc9 100644 --- a/xonssh_xxh/settings.py +++ b/xxh_xxh/settings.py @@ -1,7 +1,7 @@ import sys, os global_settings = { - 'XXH_VERSION': '0.5.7' + 'XXH_VERSION': '0.5.8' } if __name__ == "__main__": diff --git a/xxhp b/xxhp index d35106f..75c2dfb 100755 --- a/xxhp +++ b/xxhp @@ -39,45 +39,47 @@ class XxhPackage(object): def install(self): parser = argparse.ArgumentParser(description='') - parser.add_argument('package', help=f"xxh-package") + parser.add_argument('packages', nargs='+', help=f"xxh-package") parser.add_argument('-v', '--verbose', action='store_true', help=f"Verbose mode") parser.usage = parser.format_usage().replace('usage: xxhp ', 'xxhp install ') opt = parser.parse_args(sys.argv[2:]) - if not re.match('^[a-zA-Z-]+$', opt.package): - self.eeprint(f'Invalid package name: {opt.package}') + for package in opt.packages: + print(f'Install {package}') + if not re.match('^[a-zA-Z-]+$', package): + self.eeprint(f'Invalid package name: {package}') - subdir = self.package_subdir(opt.package) or self.eeprint(f"Unknown package: {opt.package}") + subdir = self.package_subdir(package) or self.eeprint(f"Unknown package: {package}") - package_git_url = f'https://github.com/xxh/{opt.package}' + package_git_url = f'https://github.com/xxh/{package}' - self.eprint(f"Git clone {package_git_url}") - package_dir = self.local_xxh_home_dir/'xxh'/subdir/opt.package - r = ![git clone --depth 1 -q @(package_git_url) @(package_dir) 1>&2] - if r.returncode != 0: - self.eeprint(f'Git clone error') + self.eprint(f"Git clone {package_git_url}") + package_dir = self.local_xxh_home_dir/'xxh'/subdir/package + r = ![git clone --depth 1 -q @(package_git_url) @(package_dir) 1>&2] + if r.returncode != 0: + self.eeprint(f'If the package already exists try reinstall: xxhp ri ') - self.eprint(f"Build {opt.package}") - @(package_dir/'build.xsh') 1>&2 - self.eprint(f"Installed {opt.package}") + self.eprint(f"Build {package}") + @(package_dir/'build.xsh') 1>&2 + self.eprint(f"Installed {package_dir}") def r(self): return self.remove() def remove(self): parser = argparse.ArgumentParser(description='') - parser.add_argument('package', help=f"xxh-package") + parser.add_argument('packages', nargs='+', help=f"xxh-package") parser.add_argument('-v', '--verbose', action='store_true', help=f"Verbose mode") parser.usage = parser.format_usage().replace('usage: xxhp ', 'xxhp remove ') opt = parser.parse_args(sys.argv[2:]) - subdir = self.package_subdir(opt.package) or self.eeprint(f"Unknown package: {opt.package}") - package_dir = self.local_xxh_home_dir / 'xxh' / subdir / opt.package - if package_dir.exists(): - rm -rf @(package_dir) - self.eprint(f"Removed {package_dir}") - else: - self.eeprint(f"Package not found: {package_dir}") + for package in opt.packages: + print(f'Remove {package}') + subdir = self.package_subdir(package) or self.eeprint(f"Unknown package: {package}") + package_dir = self.local_xxh_home_dir / 'xxh' / subdir / package + if package_dir.exists(): + rm -rf @(package_dir) + self.eprint(f"Removed {package_dir}") def ri(self): return self.reinstall() @@ -91,13 +93,18 @@ class XxhPackage(object): def list(self): parser = argparse.ArgumentParser(description='') + parser.add_argument('packages', nargs='*', help=f"xxh-package") parser.add_argument('-v', '--verbose', action='store_true', help=f"Verbose mode") parser.usage = parser.format_usage().replace('usage: xxhp ', 'xxhp remove ') opt = parser.parse_args(sys.argv[2:]) packages_dir = (self.local_xxh_home_dir / 'xxh').glob('**/xxh-*') for p in sorted(packages_dir): - print(p.name) + if opt.packages: + if p.name in opt.packages: + print(p.name) + else: + print(p.name) def package_subdir(self, name): if 'xxh-shell' in name: @@ -108,4 +115,4 @@ class XxhPackage(object): if __name__ == '__main__': - XxhPackage() \ No newline at end of file + XxhPackage()