Skip to content

Commit fb8f023

Browse files
authored
Initial CLI rewrite (temporalio#412)
1 parent 72930ba commit fb8f023

32 files changed

+6382
-0
lines changed

.github/workflows/ci.yaml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Continuous Integration
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-test:
10+
strategy:
11+
fail-fast: true
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
include:
15+
- os: ubuntu-latest
16+
checkGenCodeTarget: true
17+
cloudTestTarget: true
18+
runs-on: ${{ matrix.os }}
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
with:
23+
submodules: recursive
24+
25+
- name: Setup Go
26+
uses: actions/setup-go@v4
27+
with:
28+
go-version: '1.21'
29+
30+
- name: Test
31+
run: go test -v ./...
32+
33+
- name: Regen code, confirm unchanged
34+
if: ${{ matrix.checkGenCodeTarget }}
35+
run: |
36+
go run ./temporalcli/internal/cmd/gen-commands
37+
git diff --exit-code
38+
39+
- name: Test cloud
40+
# Only supported in non-fork runs, since secrets are not available in forks
41+
if: ${{ matrix.cloudTestTarget && (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/cli') }}
42+
env:
43+
TEMPORAL_ADDRESS: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233
44+
TEMPORAL_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
45+
TEMPORAL_TLS_CERT: client.crt
46+
TEMPORAL_TLS_CERT_CONTENT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
47+
TEMPORAL_TLS_KEY: client.key
48+
TEMPORAL_TLS_KEY_CONTENT: ${{ secrets.TEMPORAL_CLIENT_KEY }}
49+
shell: bash
50+
run: |
51+
printf '%s\n' "$TEMPORAL_TLS_CERT_CONTENT" >> client.crt
52+
printf '%s\n' "$TEMPORAL_TLS_KEY_CONTENT" >> client.key
53+
go run ./cmd/temporal workflow list --limit 2

CONTRIBUTING.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Contributing
2+
3+
## Building
4+
5+
With the latest `go` version installed, simply run the following:
6+
7+
go build ./cmd/temporal
8+
9+
## Testing
10+
11+
Uses normal `go test`, e.g.:
12+
13+
go test ./...
14+
15+
See other tests for how to leverage things like the command harness and dev server suite.
16+
17+
## Adding/updating commands
18+
19+
First, update [commands.md](temporalcli/commandsmd/commands.md) following the rules in that file. Then to regenerate the
20+
[commands.gen.go](temporalcli/commands.gen.go) file from code, simply run:
21+
22+
go run ./temporalcli/internal/cmd/gen-commands
23+
24+
This will expect every non-parent command to have a `run` method, so for new commands developers will have to implement
25+
`run` on the new command in a separate file before it will compile.

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2024 Temporal Technologies Inc. All rights reserved.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Temporal CLI
2+
3+
Temporal command-line interface and development server.
4+
5+
⚠️ Under active development and inputs/outputs may change ⚠️
6+
7+
See [the documentation](https://docs.temporal.io/cli) for install and usage information. See
8+
[CONTRIBUTING.md](CONTRIBUTING.md) for build and development information.

cmd/temporal/main.go

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/temporalio/cli/temporalcli"
7+
)
8+
9+
func main() {
10+
ctx, cancel := context.WithCancel(context.Background())
11+
defer cancel()
12+
temporalcli.Execute(ctx, temporalcli.CommandOptions{})
13+
}

go.mod

+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
module github.com/temporalio/cli
2+
3+
go 1.21
4+
5+
require (
6+
github.com/dustin/go-humanize v1.0.1
7+
github.com/fatih/color v1.16.0
8+
github.com/google/uuid v1.5.0
9+
github.com/mattn/go-isatty v0.0.20
10+
github.com/olekukonko/tablewriter v0.0.5
11+
github.com/spf13/cobra v1.8.0
12+
github.com/spf13/pflag v1.0.5
13+
github.com/stretchr/testify v1.8.4
14+
github.com/temporalio/ui-server/v2 v2.23.0
15+
go.temporal.io/api v1.26.2-0.20231129165614-630d88440548
16+
go.temporal.io/sdk v1.25.2-0.20231204212658-5fdbecc56c8c
17+
go.temporal.io/server v1.23.0-rc2.0.20231212000105-51ea367f9f37
18+
google.golang.org/grpc v1.61.0
19+
google.golang.org/protobuf v1.32.0
20+
gopkg.in/yaml.v3 v3.0.1
21+
)
22+
23+
require (
24+
cloud.google.com/go v0.112.0 // indirect
25+
cloud.google.com/go/compute v1.23.3 // indirect
26+
cloud.google.com/go/compute/metadata v0.2.3 // indirect
27+
cloud.google.com/go/iam v1.1.5 // indirect
28+
cloud.google.com/go/storage v1.36.0 // indirect
29+
github.com/apache/thrift v0.18.1 // indirect
30+
github.com/aws/aws-sdk-go v1.44.289 // indirect
31+
github.com/benbjohnson/clock v1.3.5 // indirect
32+
github.com/beorn7/perks v1.0.1 // indirect
33+
github.com/blang/semver/v4 v4.0.0 // indirect
34+
github.com/cactus/go-statsd-client/statsd v0.0.0-20200423205355-cb0885a1018c // indirect
35+
github.com/cactus/go-statsd-client/v5 v5.0.0 // indirect
36+
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
37+
github.com/cespare/xxhash/v2 v2.2.0 // indirect
38+
github.com/coreos/go-oidc/v3 v3.1.0 // indirect
39+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
40+
github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect
41+
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
42+
github.com/felixge/httpsnoop v1.0.4 // indirect
43+
github.com/go-logr/logr v1.3.0 // indirect
44+
github.com/go-logr/stdr v1.2.2 // indirect
45+
github.com/go-sql-driver/mysql v1.5.0 // indirect
46+
github.com/gocql/gocql v1.5.2 // indirect
47+
github.com/gogo/protobuf v1.3.2 // indirect
48+
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
49+
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
50+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
51+
github.com/golang/mock v1.7.0-rc.1 // indirect
52+
github.com/golang/protobuf v1.5.3 // indirect
53+
github.com/golang/snappy v0.0.4 // indirect
54+
github.com/google/s2a-go v0.1.7 // indirect
55+
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
56+
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
57+
github.com/gorilla/securecookie v1.1.1 // indirect
58+
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
59+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.1 // indirect
60+
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
61+
github.com/iancoleman/strcase v0.3.0 // indirect
62+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
63+
github.com/jackc/pgpassfile v1.0.0 // indirect
64+
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
65+
github.com/jackc/pgx/v5 v5.4.3 // indirect
66+
github.com/jmespath/go-jmespath v0.4.0 // indirect
67+
github.com/jmoiron/sqlx v1.3.4 // indirect
68+
github.com/josharian/intern v1.0.0 // indirect
69+
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
70+
github.com/labstack/echo/v4 v4.9.1 // indirect
71+
github.com/labstack/gommon v0.4.0 // indirect
72+
github.com/lib/pq v1.10.9 // indirect
73+
github.com/mailru/easyjson v0.7.7 // indirect
74+
github.com/mattn/go-colorable v0.1.13 // indirect
75+
github.com/mattn/go-runewidth v0.0.14 // indirect
76+
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
77+
github.com/olivere/elastic/v7 v7.0.32 // indirect
78+
github.com/opentracing/opentracing-go v1.2.0 // indirect
79+
github.com/pborman/uuid v1.2.1 // indirect
80+
github.com/pkg/errors v0.9.1 // indirect
81+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
82+
github.com/prometheus/client_golang v1.16.0 // indirect
83+
github.com/prometheus/client_model v0.4.0 // indirect
84+
github.com/prometheus/common v0.44.0 // indirect
85+
github.com/prometheus/procfs v0.11.0 // indirect
86+
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
87+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
88+
github.com/rivo/uniseg v0.4.4 // indirect
89+
github.com/robfig/cron v1.2.0 // indirect
90+
github.com/robfig/cron/v3 v3.0.1 // indirect
91+
github.com/sirupsen/logrus v1.9.3 // indirect
92+
github.com/stretchr/objx v0.5.0 // indirect
93+
github.com/temporalio/ringpop-go v0.0.0-20230606200434-b5c079f412d3 // indirect
94+
github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb // indirect
95+
github.com/temporalio/tchannel-go v1.22.1-0.20231116015023-bd4fb7678499 // indirect
96+
github.com/twmb/murmur3 v1.1.8 // indirect
97+
github.com/uber-common/bark v1.3.0 // indirect
98+
github.com/uber-go/tally/v4 v4.1.7 // indirect
99+
github.com/valyala/bytebufferpool v1.0.0 // indirect
100+
github.com/valyala/fasttemplate v1.2.1 // indirect
101+
go.opencensus.io v0.24.0 // indirect
102+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
103+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
104+
go.opentelemetry.io/otel v1.21.0 // indirect
105+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric v0.42.0 // indirect
106+
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v0.42.0 // indirect
107+
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect
108+
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 // indirect
109+
go.opentelemetry.io/otel/exporters/prometheus v0.42.0 // indirect
110+
go.opentelemetry.io/otel/metric v1.21.0 // indirect
111+
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
112+
go.opentelemetry.io/otel/sdk/metric v1.19.0 // indirect
113+
go.opentelemetry.io/otel/trace v1.21.0 // indirect
114+
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
115+
go.temporal.io/version v0.3.0 // indirect
116+
go.uber.org/atomic v1.11.0 // indirect
117+
go.uber.org/dig v1.17.0 // indirect
118+
go.uber.org/fx v1.20.0 // indirect
119+
go.uber.org/multierr v1.11.0 // indirect
120+
go.uber.org/zap v1.26.0 // indirect
121+
golang.org/x/crypto v0.18.0 // indirect
122+
golang.org/x/exp v0.0.0-20231127185646-65229373498e // indirect
123+
golang.org/x/mod v0.14.0 // indirect
124+
golang.org/x/net v0.20.0 // indirect
125+
golang.org/x/oauth2 v0.16.0 // indirect
126+
golang.org/x/sync v0.5.0 // indirect
127+
golang.org/x/sys v0.16.0 // indirect
128+
golang.org/x/text v0.14.0 // indirect
129+
golang.org/x/time v0.5.0 // indirect
130+
golang.org/x/tools v0.16.0 // indirect
131+
google.golang.org/api v0.155.0 // indirect
132+
google.golang.org/appengine v1.6.8 // indirect
133+
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect
134+
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
135+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
136+
gopkg.in/inf.v0 v0.9.1 // indirect
137+
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
138+
gopkg.in/validator.v2 v2.0.1 // indirect
139+
lukechampine.com/uint128 v1.3.0 // indirect
140+
modernc.org/cc/v3 v3.41.0 // indirect
141+
modernc.org/ccgo/v3 v3.16.14 // indirect
142+
modernc.org/libc v1.24.1 // indirect
143+
modernc.org/mathutil v1.5.0 // indirect
144+
modernc.org/memory v1.6.0 // indirect
145+
modernc.org/opt v0.1.3 // indirect
146+
modernc.org/sqlite v1.23.1 // indirect
147+
modernc.org/strutil v1.1.3 // indirect
148+
modernc.org/token v1.1.0 // indirect
149+
)

0 commit comments

Comments
 (0)