Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
a committed Mar 27, 2024
1 parent 5ce23d3 commit 1f2ad0e
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 12 deletions.
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ fstrider was created to reduce keystrokes. So remember two things:

## Xonsh xontrib

Xonsh xontrib creates alias `fs` (or `fstrider` if `fs` exists) to run fstrider as fast as possible.
fstrider xontrib features:
* Creates alias `fs` (or `fstrider` if `fs` exists).
* Run fstrider as fast as possible.
* Keeps history between running fstrider.

Environment variables:
* `$XONTRIB_FSTRIDER_ALIAS` - change the alias name. Recommended `s`.
Expand All @@ -87,6 +90,11 @@ Feel free to grab and implement or propose new feature. PR is welcome!

### v0.2.0
```
Xonsh xontrib
++ Creates alias `fs` (or `fstrider` if `fs` exists).
++ Run fstrider as fast as possible.
++ Keeps history between running fstrider.
Configuration
Load env config from file.
Expand Down
2 changes: 1 addition & 1 deletion fstrider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main(args=None) -> None:

d2F0Y2ggLW4uMSBzdHJpZGVyIC8vLw(args.path)

fstrider(args.path)
fstrider(args.path).run()


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion fstrider/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fstrider

if __name__ == "__main__":
strider.main()
fstrider.main()
7 changes: 3 additions & 4 deletions fstrider/fstrider.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ def __init__(self, current_path: Path = None):

self.bindings = KeyBindings()

self.run()

Path(self._app_associations_file).write_text(json.dumps(self.app_associations))


def run(self):
"""Start striding."""
Expand Down Expand Up @@ -83,6 +79,9 @@ def run(self):

application.run()

Path(self._app_associations_file).write_text(json.dumps(self.app_associations))


def load_style(self):
"""Load style."""
style = Style.from_dict({})
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "fstrider"
version = "0.1.16"
version = "0.1.17"
license = {file = "LICENSE"}
description = "Library of the useful macroses for the xonsh shell."
classifiers = [
Expand Down
8 changes: 6 additions & 2 deletions tests/test_fstrider.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
def test_fstrider():
assert 1 == 1
from pathlib import Path
from fstrider.fstrider import fstrider

def test_fstrider_init():
fs = fstrider()
assert fs.current_path == Path('.').absolute()
9 changes: 7 additions & 2 deletions xontrib/fstrider.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
"""Xontrib for Strider."""

import fstrider as _fstrider
from fstrider.fstrider import fstrider as _fstrider
from shutil import which as _which

__xonsh__._fstrider = None
_cmd = __xonsh__.env.get('XONTRIB_FSTRIDER_ALIAS', "fstrider" if _which("fs") else "fs")

@aliases.register(_cmd)
def _alias_strider(args):
_fstrider.main(args)
p = args[0] if args else None
if __xonsh__._fstrider is None:
__xonsh__._fstrider = _fstrider(p)
__xonsh__._fstrider.run()

0 comments on commit 1f2ad0e

Please sign in to comment.