Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 30, 2024. It is now read-only.
/coder-v1-cliPublic archive

Commitb9e64a5

Browse files
committed
It works!
Change-Id: If54d2ff362aca39cb92619418a31e23aa8ecb367
1 parentd4f57e8 commitb9e64a5

File tree

7 files changed

+586
-37
lines changed

7 files changed

+586
-37
lines changed

‎cmd/coder/main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ import (
55
"net/http"
66
_"net/http/pprof"
77
"os"
8+
"path/filepath"
89

910
"github.com/spf13/pflag"
1011

12+
"github.com/mutagen-io/mutagen/pkg/command/mutagen"
1113
"go.coder.com/cli"
1214
)
1315

@@ -39,6 +41,7 @@ func (r *rootCmd) Subcommands() []cli.Command {
3941
&urlsCmd{},
4042
&versionCmd{},
4143
&configSSHCmd{},
44+
&mutagenCmd{},
4245
}
4346
}
4447

@@ -48,5 +51,9 @@ func main() {
4851
log.Println(http.ListenAndServe("localhost:6060",nil))
4952
}()
5053
}
54+
iffilepath.Base(os.Args[0])=="mutagen" {
55+
mutagen.Main()
56+
return
57+
}
5158
cli.RunRoot(&rootCmd{})
5259
}

‎cmd/coder/mutagen.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package main
2+
3+
import (
4+
"github.com/mutagen-io/mutagen/pkg/command/mutagen"
5+
"github.com/spf13/pflag"
6+
"go.coder.com/cli"
7+
"os"
8+
)
9+
10+
typemutagenCmdstruct {
11+
12+
}
13+
14+
func (m*mutagenCmd)Spec() cli.CommandSpec {
15+
return cli.CommandSpec{
16+
Name:"mutagen",
17+
Usage:"[mutagen args...]",
18+
Desc:"call the embedded mutagen",
19+
RawArgs:true,
20+
}
21+
}
22+
23+
func (m*mutagenCmd)Run(_*pflag.FlagSet) {
24+
// Pop out first argument (coder) so mutagen thinks its mutagen.
25+
copy(os.Args,os.Args[1:])
26+
os.Args=os.Args[:len(os.Args)-1]
27+
mutagen.Main()
28+
}
29+

‎cmd/coder/sync.go

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package main
22

33
import (
4-
"os"
54
"path/filepath"
65
"strings"
76

@@ -40,14 +39,6 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
4039

4140
entClient:=requireAuth()
4241

43-
info,err:=os.Stat(local)
44-
iferr!=nil {
45-
flog.Fatal("%v",err)
46-
}
47-
if!info.IsDir() {
48-
flog.Fatal("%s must be a directory",local)
49-
}
50-
5142
remoteTokens:=strings.SplitN(remote,":",2)
5243
iflen(remoteTokens)!=2 {
5344
flog.Fatal("remote misformatted")
@@ -64,17 +55,18 @@ func (cmd *syncCmd) Run(fl *pflag.FlagSet) {
6455
flog.Fatal("make abs path out of %v: %v",local,absLocal)
6556
}
6657

67-
s:= sync.Sync{
68-
Init:cmd.init,
69-
Env:env,
70-
RemoteDir:remoteDir,
71-
LocalDir:absLocal,
72-
Client:entClient,
58+
s:= sync.Syncer{
59+
Environment:env,
60+
RemoteDir:remoteDir,
61+
LocalDir:absLocal,
7362
}
74-
forerr==nil||err==sync.ErrRestartSync {
75-
err=s.Run()
63+
64+
err=s.Create()
65+
iferr!=nil {
66+
flog.Fatal("%v",err)
7667
}
7768

69+
err=s.Monitor()
7870
iferr!=nil {
7971
flog.Fatal("%v",err)
8072
}

‎go.mod

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,33 @@ go 1.14
44

55
require (
66
cdr.dev/wsepv0.0.0-20200616212001-0613cfe9a4ac
7-
github.com/fatih/colorv1.9.0// indirect
8-
github.com/gorilla/websocketv1.4.1
7+
github.com/bmatcuk/doublestarv1.3.1// indirect
8+
github.com/hashicorp/yamuxv0.0.0-20200609203250-aecfd211c9ce// indirect
99
github.com/kirsle/configdirv0.0.0-20170128060238-e45d2f54772f
1010
github.com/klauspost/compressv1.10.8// indirect
11-
github.com/mattn/go-colorablev0.1.6// indirect
11+
github.com/lucas-clemente/quic-gov0.17.2// indirect
12+
github.com/marten-seemann/qtlsv0.10.0// indirect
13+
github.com/mattn/go-colorablev0.1.7// indirect
14+
github.com/mutagen-io/mutagenv0.12.0-alpha1
15+
github.com/pion/sdp/v2v2.3.9// indirect
16+
github.com/pion/stunv0.3.5// indirect
17+
github.com/pion/webrtc/v2v2.2.17// indirect
1218
github.com/pkg/browserv0.0.0-20180916011732-0a3d74bf9ce4
13-
github.com/rjeczalik/notifyv0.9.2
1419
github.com/spf13/pflagv1.0.5
1520
go.coder.com/cliv0.4.0
1621
go.coder.com/flogv0.0.0-20190906214207-47dd47ea0512
17-
golang.org/x/cryptov0.0.0-20200422194213-44a606286825
18-
golang.org/x/syncv0.0.0-20200317015054-43a5402ce75a
19-
golang.org/x/sysv0.0.0-20200615200032-f1bc736245b1
22+
golang.org/x/cryptov0.0.0-20200622213623-75b288015ac9
23+
golang.org/x/netv0.0.0-20200625001655-4c5254603344// indirect
24+
golang.org/x/syncv0.0.0-20200317015054-43a5402ce75a// indirect
25+
golang.org/x/sysv0.0.0-20200625212154-ddb9806d33ae
26+
golang.org/x/textv0.3.3// indirect
2027
golang.org/x/timev0.0.0-20191024005414-555d28b269f0
2128
golang.org/x/xerrorsv0.0.0-20191204190536-9bdfabe68543
29+
google.golang.org/genprotov0.0.0-20200702021140-07506425bd67// indirect
30+
google.golang.org/grpcv1.30.0// indirect
31+
google.golang.org/protobufv1.25.0// indirect
32+
k8s.io/apimachineryv0.18.5// indirect
2233
nhooyr.io/websocketv1.8.6
2334
)
35+
36+
replacegithub.com/mutagen-io/mutagen =>github.com/cdr/mutagenv0.12.0-alpha1.0.20200702032615-836681a5c914

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp