Skip to content

Changes to consume tcli as a library - #14

Merged
ppadmavilasom merged 3 commits into
mainfrom
lib/init
Jul 27, 2026
Merged

Changes to consume tcli as a library#14
ppadmavilasom merged 3 commits into
mainfrom
lib/init

Conversation

@ppadmavilasom

Copy link
Copy Markdown
Contributor
  • Allows extensions as shown under examples/_pubsub to implement your own commands.

- Allows extensions as shown under examples/_pubsub to implement your
  own commands.
- [pubsub spec](/examples/_pubsub/pubsub.json)
- [pubsub cmd support](/examples/_pubsub/cmd)

Now that tcli's reusable packages live under `pkg/` (instead of `internal/`),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not able to understand the example of sns-sqs.

Please update example of petstore as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point.
I have updated the example from a new project perspective. A full working example will require the current changes to go in first as the dependencies will not properly resolve without these changes in main. I will provide steps to test locally here (this will not apply as is when this branch is merged so not making it part of README)
If you want to check out how this works locally, you will have to redirect the ref locally. Assuming you create a new go project and create main.go as shown in example.
Do the following to get that project in a testable state for pubsub extensions

go mod init tcli/pubsubtest

edit go.mod to add the following (assumes you create example in the same parent folder as this project. otherwise, change redirect as applies)

go 1.26.5

require github.com/hpinc/tcli v0.0.0
replace github.com/hpinc/tcli => ../tcli

run go mod tidy and you should be able to run go run main.go now with proper config override.

petstore does not need changes. It's usage example will continue to work without changes.
Note that the usage as a lib is primarily aimed at extending tcli functionality via the x-extension mechanism to support custom commands.

@RehanChanegaon RehanChanegaon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changed files. Looks good to me. +1

@ppadmavilasom
ppadmavilasom merged commit 41e53e8 into main Jul 27, 2026
1 check passed
@ppadmavilasom
ppadmavilasom deleted the lib/init branch July 27, 2026 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants