cobra-cli icon indicating copy to clipboard operation
cobra-cli copied to clipboard

refactor generated command & subcommand boilerplate

Open jxsl13 opened this issue 2 years ago • 11 comments

  • This is not my final image of how the commands should be constructed but my final image would require to work with the Go AST library which I am not familiar with and imo might be overkill.
  • I usually do call rootCmd.AddCommand(NewSubCommand()) inside of the constructor NewRootCmd() which would be quite hard to do with generated code. cobra-cli would need to actually parse generated Go code and append lines at specific locations for that to work with sub commands that are added afterwards.

That's way too much work so I did go a slightly easier way. Might not be the final stage but definitely a step forward.

jxsl13 avatar Mar 01 '22 21:03 jxsl13

@johnSchnake please review

jxsl13 avatar Mar 14 '22 15:03 jxsl13

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar May 14 '22 00:05 github-actions[bot]

Still haven't gotten around to this one. Sorry.

marckhouzam avatar May 14 '22 01:05 marckhouzam

No worries!!!! We can mark this for post v1.5.0 if that makes sense?

jpmcb avatar May 14 '22 19:05 jpmcb

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Jul 14 '22 00:07 github-actions[bot]

blub

jxsl13 avatar Jul 14 '22 23:07 jxsl13

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Sep 27 '22 00:09 github-actions[bot]

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Nov 28 '22 00:11 github-actions[bot]

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Jan 29 '23 00:01 github-actions[bot]

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Mar 31 '23 00:03 github-actions[bot]

This PR is being marked as stale due to a long period of inactivity

github-actions[bot] avatar Jun 01 '23 00:06 github-actions[bot]