Skip to content

Commit 006b942

Browse files
committed
v0.1.0
Signed-off-by: Akihiro Suda <[email protected]>
1 parent 1c43a50 commit 006b942

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

README.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@ This is akin to `docker run -p 8080:80 -v $(pwd):/mnt IMAGE`, but `sshocker` is
1010

1111
## Install
1212

13+
Download from https://github.com/AkihiroSuda/sshocker/releases .
14+
15+
To download using curl:
16+
```
17+
curl -o sshocker --fail -L https://github.com/AkihiroSuda/sshocker/releases/latest/download/sshocker-$(uname -s)-$(uname -m)
18+
chmod +x sshocker
19+
```
20+
21+
To compile from source:
1322
```console
14-
$ go get github.com/AkihiroSuda/sshocker/cmd/sshocker
23+
go get github.com/AkihiroSuda/sshocker/cmd/sshocker
1524
```
1625

1726
Tested on macOS client and Linux server. May not work on other environments, especially on Windows.

cmd/sshocker/main.go

+12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package main
22

33
import (
4+
"fmt"
45
"os"
56

7+
"github.com/AkihiroSuda/sshocker/pkg/version"
68
"github.com/sirupsen/logrus"
79
"github.com/urfave/cli/v2"
810
)
@@ -13,16 +15,26 @@ func newApp() *cli.App {
1315
app.Name = "sshocker"
1416
app.Usage = "ssh + reverse sshfs + port forwarder, in Docker-like CLI"
1517
app.UsageText = "sshocker run -p LOCALIP:LOCALPORT:REMOTEPORT -v LOCALDIR:REMOTEDIR USER@HOST"
18+
// we can't set app.Version because it conflicts with our `-v`
1619

1720
app.Flags = []cli.Flag{
1821
&cli.BoolFlag{
1922
Name: "debug",
2023
Usage: "debug mode",
2124
Destination: &debug,
2225
},
26+
&cli.BoolFlag{
27+
Name: "version",
28+
Usage: "print the version",
29+
},
2330
}
2431
app.Flags = append(app.Flags, setHidden(runFlags, true)...)
2532
app.Before = func(context *cli.Context) error {
33+
if context.Bool("version") {
34+
fmt.Printf("sshocker version %s\n", version.Version)
35+
os.Exit(0)
36+
return nil
37+
}
2638
if debug {
2739
logrus.SetLevel(logrus.DebugLevel)
2840
}

pkg/version/version.go

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package version
2+
3+
const Version = "0.1.0"

0 commit comments

Comments
 (0)