dub icon indicating copy to clipboard operation
dub copied to clipboard

[FEAT]: `dub` CLI

Open steven-tey opened this issue 1 year ago • 16 comments

Building on @sujjeee's incredible work: https://github.com/sujjeee/dubco

Proposal

npm i dub (published via NPM)

Commands

  • dub help: Shows a list of commands that are available

  • dub login: Login to Dub.co via API token.

    • Bonus: Auto-open a new window and log user in, but would require programmatic API token generation. Example: https://github.com/unkeyed/examples/tree/main/unkey-cli
  • dub config: Show current config

    • Current user email
    • Current project
    • Current domain
  • dub config set: Set current config

    • Project selector
    • Domain selector

    Example:

    	? Switch to:
      ── Projects ────────────────────────
    ○ Dub (dub)
    ○ Steven Tey (steven)
    ○ One Word Domains (owd)
      ─────────────────────────────────
    ○ Cancel
    
  • dub shorten [url] [key]: Shorten a URL

    • If url and key are not provided, go through the current flow:

      ✔ Enter your Destination URL : … 
      ✔ Enter your Short link : …
      ✔ Short link created!
      
    • If url is provided, create short link with random key

    • If both url and key are provided, create short link with provided key

MVP notice

This is the early MVP of the dub CLI and will be improved in the future!

steven-tey avatar Dec 17 '23 21:12 steven-tey

🙋‍♂️

sujjeee avatar Dec 18 '23 08:12 sujjeee

@steven-tey @sujjeee I have one idea related to this. A few days back there was an issue created by you @steven-tey to programmatically create the QR Code which I wanted to work on. Do you think it will be a good idea to let the user create the QR code using CLI by adding some extra parameters and letting it download in the user file path? From there he can also then do many things like storing it in his S3 or Redis cache. What do you guys think?

VishalMCF avatar Dec 19 '23 08:12 VishalMCF

@VishalMCF 👀

https://github.com/dubinc/dub/assets/101963203/594a26c2-a53d-4968-a543-e90a144e106c

sujjeee avatar Dec 19 '23 10:12 sujjeee

@sujjeee Great!! You stole my potential issue already :)

VishalMCF avatar Dec 19 '23 11:12 VishalMCF

@VishalMCF I realized that I have a simpler solution for this, so i implemented it.

sujjeee avatar Dec 19 '23 11:12 sujjeee

Is there anything that I can implement? If you have any idea?

On Tue, 19 Dec 2023 at 16:58, Suraj ! @.***> wrote:

@VishalMCF https://github.com/VishalMCF I realized that I have a simpler solution for this, so i implemented it.

— Reply to this email directly, view it on GitHub https://github.com/dubinc/dub/issues/506#issuecomment-1862588042, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQYCBCTLNL7MKTOL63L7PYDYKF26DAVCNFSM6AAAAABAYUJ5NGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRSGU4DQMBUGI . You are receiving this because you were mentioned.Message ID: @.***>

VishalMCF avatar Dec 19 '23 11:12 VishalMCF

@VishalMCF

You can try building a Dub React library. Take a look at OpenAI's and Cloudinary's React libraries for inspiration.

sujjeee avatar Dec 19 '23 16:12 sujjeee

@VishalMCF are you working on the library ?

aakash2330 avatar Dec 23 '23 05:12 aakash2330

@aakash2330 No bro. A little less interested in working on frontend side.

VishalMCF avatar Dec 23 '23 07:12 VishalMCF

@sujjeee can you elaborate a little more about the dub react library .

aakash2330 avatar Dec 23 '23 17:12 aakash2330

@aakash2330 Its not react library, Its like nodejs library or we can say nodejs sdk

Look at this prototype 👇 Screenshot 2023-12-23 224034

something similar, like import dub from a lib and create new instance, pass api key and then pass the other args and create a short url.

sujjeee avatar Dec 23 '23 17:12 sujjeee

Yes , that's what I was confused about , whether the context was sdk or a react components library . Thanks for clarifying . I'm really interested on working on it , any suggestions would be greatly helpful .

aakash2330 avatar Dec 23 '23 17:12 aakash2330

@aakash2330 Its great to see you excited about this, but ask @steven-tey if its really needed or not, because most people prefer to do direct API calls instead of installing an additional library for this. If you really want to contribute, then contribute to improving the APIs as they are still in beta phase.

sujjeee avatar Dec 23 '23 17:12 sujjeee

makes sense .

aakash2330 avatar Dec 24 '23 05:12 aakash2330

Hi guys, Hi @sujjeee

Just discovering dub :)

About the library, are you looking for a typescript lib like a BFF or data layer to connect dub's APIs?

If so, I'm interested to contribute. This is what I did at work Example

ccreusat avatar Dec 29 '23 16:12 ccreusat