Skip to content

Commit 1b4136c

Browse files
authored
Merge pull request #7 from note/add-more-readme
README improvements
2 parents d4fa939 + 1e0f187 commit 1b4136c

File tree

1 file changed

+77
-8
lines changed

1 file changed

+77
-8
lines changed

README.md

Lines changed: 77 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,86 @@
1+
[![Build Status](https://travis-ci.com/note/teleport-scala.svg?branch=master)](https://travis-ci.org/note/teleport-scala)
2+
[![GitHub release](https://img.shields.io/github/v/release/note/teleport-scala.svg)](https://github.com/note/teleport-scala/releases/)
3+
14
# teleport-scala
25

3-
[teleport](https://github.com/bollu/teleport) rewritten in Scala as a showcase that writing native CLIs in Scala
6+
A clone of [teleport](https://github.com/bollu/teleport) written in Scala as a showcase that writing native CLIs in Scala
47
might not be such a bad idea.
58

69
[![asciicast](https://asciinema.org/a/Zj1ZDAgF02PP3JpD5RNtwBz0M.svg)](https://asciinema.org/a/Zj1ZDAgF02PP3JpD5RNtwBz0M)
710

8-
`goto` command cannot be fully implemented in subprocess. `teleport-scala goto point` executable will return
9-
status code 2 after printing the absolute path of the `point` (if `point` is registered teleport point). It's not
10-
possible for the `teleport-scala` to change current directory of the caller process. The solution for that
11-
is to have a bash function sourced. That function can use absolute path returned by `teleport scala`.
11+
## How to build teleport-scala
12+
13+
You should have following on your `$PATH`:
14+
15+
* Java JDK 11
16+
* `sbt`
17+
* `native-image`
18+
19+
You can consult file `.travis.yml` in case of difficulties in installing prerequisites. Once you have everything installed
20+
you can:
21+
22+
```
23+
./build.sh
24+
```
25+
26+
As a result `teleport-scala.jar` and executable `teleport-scala` should be created.
27+
28+
## Bring `tp` into scope
29+
30+
If you watched the asciiname animation you may have noticed that it uses `tp` command as opposed to `teleport-scala`.
31+
T bring `tp` into scope add the following to your `.zshrc`/`.bashrc`:
32+
33+
```
34+
source /your/path/to/teleport-scala/teleport.sh
35+
```
36+
37+
### For curious - what's the point of having `teleport-scala` and `tp`?
38+
39+
The problem is that `goto` command cannot be fully implemented in a subprocess; it's not possible for the
40+
`teleport-scala` to change working directory of the caller process. Therefore, `teleport-scala goto point` returns
41+
status code 2 and prints the absolute path of the `point`. As bash function `fp` is sourced it can change the working
42+
directory.
43+
44+
If that sounds vague to you just read `teleport.sh` file - it's just a few lines of code.
45+
46+
## Usage
47+
48+
```
49+
> tp --help
50+
Usage:
51+
teleport-scala [--no-colors] [--no-headers] add
52+
teleport-scala [--no-colors] [--no-headers] list
53+
teleport-scala [--no-colors] [--no-headers] remove
54+
teleport-scala [--no-colors] [--no-headers] goto
55+
teleport-scala [--no-colors] [--no-headers] version
56+
57+
teleport: A tool to quickly switch between directories
58+
59+
Options and flags:
60+
--help
61+
Display this help text.
62+
--no-colors
63+
Disable ANSI color codes
64+
--no-headers
65+
Disable printing headers for tabular data
66+
67+
Subcommands:
68+
add
69+
add a teleport point
70+
list
71+
list all teleport points
72+
remove
73+
remove a teleport point
74+
goto
75+
go to a created teleport point
76+
version
77+
display version
78+
```
79+
80+
## Running smoke-test
1281

13-
In `.zshrc`/`.bashrc`:
82+
You need to build the project first. If it's built then:
1483

1584
```
16-
source /path/to/teleport-scala/teleport.sh
17-
```
85+
./smoke-test.sh
86+
```

0 commit comments

Comments
 (0)