HackMan
HackMan copied to clipboard
A bunch of ideas...
First of all, love this project. I've been wanting to do something like this for a while now. Here's some (pretty out there) ideas for this project:
General:
- I haven't tried it, but does
hackman g AppDelegatealso work? (Would be awesome if it did. I would feel much more comfortable with using proper case for property types, especially.)
On new project creation:
cdinto the directory just created- run
git init
After every command, I would love to see:
- Run
git add . ; git commit -a -m "{suitable message related to what hackman command was just performed, might actually include the command.}" - Also, is there any reason not to run
xcodegenfor them after every command?
Farther out there:
- I'd love to see some kind of simple (maybe yaml or json) file created for each generate command. (Or maybe just one database-like file per project, that keeps track of all the various things that are generated.) This would allow you to append to previously generated files. So instead of one long
hackman g scaffold album name uuid artist:artist created_at:date updated_at:date --coordinator, you could runhackman g scaffold albumthenhackman a[ppend] album namethenhackman a album uuid, and have it do the right thing.
I might be willing to help out with this project. Do you have a TODO list somewhere already?
(I now see the TODO list in the readme.)
Hi @mgrider, thanks for the feedback and sorry for the late delay — busy week :)
General: I haven't tried it, but does hackman g AppDelegate also work? (Would be awesome if it did. I would feel much more comfortable with using proper case for property types, especially.)
It didn't — but I just pushed an updated.
hackman generate scaffold human name is_favorite:bool phone_number:string --view=table --coordinator
and
hackman generate scaffold Human name isFavorite:Bool phoneNumber:String --view=table --coordinator
result identical results now.
After every command, I would love to see: Run git add . ; git commit -a -m "{suitable message related to what hackman command was just performed, might actually include the command.}" Also, is there any reason not to run xcodegen for them after every command?
Adding git support automatically doesn't sound bad!
About xcodegen I was not sure, if i wanted xcodegen as a hard dependency. Currently, you can use the generators just fine without xcodegen installed on your computer.
Farther out there: I'd love to see some kind of simple (maybe yaml or json) file created for each generate command. (Or maybe just one database-like file per project, that keeps track of all the various things that are generated.) This would allow you to append to previously generated files. So instead of one long hackman g scaffold album name uuid artist:artist created_at:date updated_at:date --coordinator, you could run hackman g scaffold album then hackman a[ppend] album name then hackman a album uuid, and have it do the right thing.
I like the idea for updates -- but do you think it could be achievable without something like a .commands_history file?
Offhand, I can imagine it working without a .commands_history (or other metadata file) by parsing the generated file to figure out where to make the new edit. This might be helped along with the inclusion of comments at some key places, maybe?
More requests, after playing with this for a couple of days:
-
project setup could be interactive, and ask for the following:
- bundle identifier (and maybe some other stuff that could go into the XcodeGen config file, like supported orientations, etc.)
- use cocoapods? - could run
pod init - use swiftlint? - would be sweet if it set up the build hook for you
- use fastlane? - could run
fastlane init
-
regarding swiftlint...
- whitespace (and lots of other style/formatting stuff) is a bit out of control in the generated files (Admittedly, I'm totally anal about that kind of stuff.) (I think it would be most ideal to just run
swiftlint autocorrect --formatin the project folder after any hackman command, (alternatively specifying the files just created.) But of course then that's another dependency. Another option is to fix the templates, but it may be difficult to cover all cases, and is probably low bang-for-buck ratio. - ...of course there are quite a few alternatives to
swiftlint, an overview is here: https://nshipster.com/swift-format/
- whitespace (and lots of other style/formatting stuff) is a bit out of control in the generated files (Admittedly, I'm totally anal about that kind of stuff.) (I think it would be most ideal to just run
A couple of things I noticed that should maybe be fixed:
-
paths
- The ViewController generator is creating a new folder named
Coordinator(not to be confused withCoordinators) that only it uses (only when -c is specified, of course) - I think all these folder/path names should be configurable. (Another fine thing to override in a user-configuration file!)
- The ViewController generator is creating a new folder named
-
generator requirements
- Basically, whenever a generator wouldn't generate something that compiles, it should probably error out and tell you about this.
- Here's the one I noticed:
ViewControllerTablerequires at least one property (or there is a compilation error).