NAICNO / Jobanalyzer

Easy to use resource usage report
MIT License
0 stars 1 forks source link

For #681 - Avoid too many update point for new commands #692

Closed lars-t-hansen closed 1 day ago

lars-t-hansen commented 1 day ago

For every new command at least four points in four different files would have to be updated. This was accidental because the non-sample-analysis commands did not have a shared interface. This patch introduces the interface and moves shared application logic for commands from sonalyze.go into application/command.go. As a result, new commands should only need to update the latter file unless they introduce a new interface that is neither SampleAnalyisCommand or SimpleCommand.

The change also necessitated moving the integration tests that were stuck in cmd/ packages before into the application/ directory. This is definitely for the best.

Finally, I realized that daemon is not a command in the same sense that jobs is - it is something that is specific to the sonalyze application, and other applications using the sonalyze logic (naicprofile for example) will not want daemon. So daemon moved back to a top-level directory. All daemon-related logic should now be isolated to sonalyze.go and the daemon/ subdirectory.