diff --git a/examples/grpc-client/hello.md b/examples/grpc-client/hello.md new file mode 100644 index 000000000..1ed7d2b71 --- /dev/null +++ b/examples/grpc-client/hello.md @@ -0,0 +1,9 @@ +# Heading L1 + +```sh { id=01HE2XR0Z3WD9A89XR5XA959QP name=id-present interpreter=bash terminalRows=2 } +echo "Existent ID" +``` + +```sh { name=id-missing interpreter=bash terminalRows=2 } +echo "Without ID" +``` diff --git a/internal/utils/id.go b/internal/idgen/id.go similarity index 99% rename from internal/utils/id.go rename to internal/idgen/id.go index 29ca7d47c..80d5cfe67 100644 --- a/internal/utils/id.go +++ b/internal/idgen/id.go @@ -1,5 +1,5 @@ // Package utils contains utility functions for the application -package utils +package idgen import ( "io" diff --git a/internal/utils/id_test.go b/internal/idgen/id_test.go similarity index 98% rename from internal/utils/id_test.go rename to internal/idgen/id_test.go index c6c7dd25c..999a00717 100644 --- a/internal/utils/id_test.go +++ b/internal/idgen/id_test.go @@ -1,4 +1,4 @@ -package utils +package idgen import ( "sync" diff --git a/internal/runner/command.go b/internal/runner/command.go index a2bf44761..c42d14284 100644 --- a/internal/runner/command.go +++ b/internal/runner/command.go @@ -15,7 +15,7 @@ import ( "github.com/creack/pty" "github.com/pkg/errors" - "github.com/stateful/runme/internal/utils" + "github.com/stateful/runme/internal/idgen" "go.uber.org/multierr" "go.uber.org/zap" ) @@ -198,7 +198,7 @@ func newCommand(cfg *commandConfig) (*command, error) { extraArgs = append(extraArgs, "-c", script) case CommandModeTempFile: for { - id := utils.GenerateID() + id := idgen.GenerateID() tempScriptFile = filepath.Join(cfg.Directory, fmt.Sprintf(".runme-script-%s", id)) if fileExtension != "" { diff --git a/internal/runner/service.go b/internal/runner/service.go index 8be36fecf..fa022921c 100644 --- a/internal/runner/service.go +++ b/internal/runner/service.go @@ -11,8 +11,8 @@ import ( "github.com/pkg/errors" "github.com/stateful/runme/internal/env" runnerv1 "github.com/stateful/runme/internal/gen/proto/go/runme/runner/v1" + "github.com/stateful/runme/internal/idgen" "github.com/stateful/runme/internal/rbuffer" - "github.com/stateful/runme/internal/utils" "github.com/stateful/runme/pkg/project" "go.uber.org/zap" "golang.org/x/sync/errgroup" @@ -155,7 +155,7 @@ func ConvertRunnerProject(runnerProj *runnerv1.Project) (project.Project, error) } func (r *runnerService) Execute(srv runnerv1.RunnerService_ExecuteServer) error { - logger := r.logger.With(zap.String("_id", utils.GenerateID())) + logger := r.logger.With(zap.String("_id", idgen.GenerateID())) logger.Info("running Execute in runnerService") diff --git a/internal/runner/session.go b/internal/runner/session.go index 0fa44766c..c35d7520f 100644 --- a/internal/runner/session.go +++ b/internal/runner/session.go @@ -5,7 +5,7 @@ import ( "sync" lru "github.com/hashicorp/golang-lru/v2" - "github.com/stateful/runme/internal/utils" + "github.com/stateful/runme/internal/idgen" "github.com/stateful/runme/pkg/project" "go.uber.org/zap" ) @@ -36,7 +36,7 @@ func NewSession(envs []string, proj project.Project, logger *zap.Logger) (*Sessi } s := &Session{ - ID: utils.GenerateID(), + ID: idgen.GenerateID(), envStore: newEnvStore(sessionEnvs...), logger: logger, diff --git a/internal/runner/shell_session.go b/internal/runner/shell_session.go index 646993ec6..f0354dfc8 100644 --- a/internal/runner/shell_session.go +++ b/internal/runner/shell_session.go @@ -8,8 +8,8 @@ import ( "github.com/creack/pty" "github.com/pkg/errors" + "github.com/stateful/runme/internal/idgen" xpty "github.com/stateful/runme/internal/pty" - "github.com/stateful/runme/internal/utils" "golang.org/x/term" ) @@ -25,7 +25,7 @@ type ShellSession struct { } func NewShellSession(command string) (*ShellSession, error) { - id := utils.GenerateID() + id := idgen.GenerateID() cmd := exec.Command(command) cmd.Env = append(os.Environ(), "RUNMESHELL="+id)