github-pewpew icon indicating copy to clipboard operation
github-pewpew copied to clipboard

Added support to delete codespaces just like repositories

Open AnishDe12020 opened this issue 1 year ago • 7 comments

ref #36

I have added support for deleting codespaces with this CLI tool. Main changes -

  • Request additional codespace scope during auth
  • More functions (mostly copies of the ones for repos) but for codespaces
  • Small change in config.js to respect config path for linux machines (.config/com.adrianmg.github-pewpew)

Use the codespaces argument with ghpew for the same.

Here is a screenshot - image

AnishDe12020 avatar Jul 26 '22 11:07 AnishDe12020

Thanks for contributing, @AnishDe12020!

Sharing some thoughts:

  1. Have you tried if existing users will be able to re-auth once a new scope is detected?
  2. Have you thought about adding help, -h, and --help to describe different options to run the command? This seems necessary to promote the discoverability of this and upcoming features (such as gists?)
  3. As we add more commands, I wonder if we should eventually abstract the UI a bit more, as it can get very verbose with mane ifs and elses. Thoughts?

adrianmg avatar Jul 29 '22 22:07 adrianmg

Thanks for contributing, @AnishDe12020!

Sharing some thoughts:

  1. Have you tried if existing users will be able to re-auth once a new scope is detected?
  2. Have you thought about adding help, -h, and --help to describe different options to run the command? This seems necessary to promote the discoverability of this and upcoming features (such as gists?)
  3. As we add more commands, I wonder if we should eventually abstract the UI a bit more, as it can get very verbose with mane ifs and elses. Thoughts?
  1. I will add a check in the codespace command and if i am not able to retrieve codespaces, I will delete the config file and re run main (essentially a re auth process). ~~I will get this done today~~ Done (https://github.com/adrianmg/github-pewpew/pull/37/commits/21b41b8090a9e69fb67bada1a6cb5ccb598d8001)

2 & 3: I can use a library like commander.js or similar (easier arg parsing, automated help commands). Done, the help command is autogenerated and the code is much cleaner now (https://github.com/adrianmg/github-pewpew/pull/37/commits/55803a0899e35cad4c81601c987c22a6eec49eb5)

AnishDe12020 avatar Jul 30 '22 03:07 AnishDe12020

Todo before releasing:

  • [x] test.js should include codespaces
  • [x] Update README with new instructions

adrianmg avatar Jul 31 '22 23:07 adrianmg

@AnishDe12020 I wonder if we can remove the commander.js dependency and achieve similar functionality with a couple of helper functions 🤔

I like we are splitting commands into different files and how simple index.js is now, but one of the goals of the project was to reduce third-party code and dependencies as much as I could.

adrianmg avatar Jul 31 '22 23:07 adrianmg

@AnishDe12020 I wonder if we can remove the commander.js dependency and achieve similar functionality with a couple of helper functions thinking

I like we are splitting commands into different files and how simple index.js is now, but one of the goals of the project was to reduce third-party code and dependencies as much as I could.

I have accomplished the same with a switch statement now, the help message is hardcoded though. I have also updated the tests and the README

AnishDe12020 avatar Aug 01 '22 10:08 AnishDe12020

@AnishDe12020 I'll try to follow up on pending conversations during this weekend. Thanks for your time!

adrianmg avatar Aug 02 '22 19:08 adrianmg

@IvanGuardado @AnishDe12020, excellent discussion!

I was busy shipping https://adrianmato.art last week, but I'd be catching up with this soon 🙇

adrianmg avatar Aug 08 '22 04:08 adrianmg

@adrianmg any update on this pr?

AnishDe12020 avatar Aug 29 '22 01:08 AnishDe12020

@AnishDe12020 looking into it

adrianmg avatar Sep 06 '22 08:09 adrianmg

@AnishDe12020 there is a new bug when repos are listed but the command is cancelled:

image

I'm not sure we want to show the help command in such cases?

adrianmg avatar Sep 06 '22 08:09 adrianmg

~~looking into it~~ fixed in adrianmg/github-pewpew@5f582ae (#37)

forgot to break out of the switch block there

AnishDe12020 avatar Sep 06 '22 09:09 AnishDe12020

Better formatting for help command + cleaner function

image

adrianmg avatar Sep 06 '22 10:09 adrianmg

@AnishDe12020 @IvanGuardado any thoughts on this one?

https://twitter.com/adrianmg/status/1575682566136287232

adrianmg avatar Sep 30 '22 04:09 adrianmg

@AnishDe12020 @IvanGuardado any thoughts on this one?

https://twitter.com/adrianmg/status/1575682566136287232

As I see it being a breaking change for existing users if it shows the help command when no args are passed, I think it would be better to retain the repos functionality when running just ghpew. However showing that more commands can be viewed by running ghpew help in the welcome message should be good

AnishDe12020 avatar Sep 30 '22 04:09 AnishDe12020

As I see it being a breaking change for existing users

I thought so, but then I realized there's no "breaking" changes as they can't currently automate it without user intervention to provide a choice of repos to be deleted 🤔

adrianmg avatar Sep 30 '22 05:09 adrianmg