Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Easily handle CLI operation via Python instead of regular Bash programs. Parent comment
My bash-modules[0] project[1] may help you with that. Typically, I perform script refactoring in these steps:
1. Split code into few subroutines with clear boundaries between them, or split a large script into multiple simpler scripts.
2. Add an error handler with transparent message to every line of code.
3. Add command line options to override hard-coded things, to be able to test things in isolation.
4. Write documentation (man-page) for script, for future self.
5. Write test cases.
6. Refactor code, following best practices.
[0]: http://vlisivka.github.io/bash-modules/
[1]: https://github.com/vlisivka/bash-modules
There are no comments on this comment yet.
My bash-modules[0] project[1] may help you with that. Typically, I perform script refactoring in these steps:
1. Split code into few subroutines with clear boundaries between them, or split a large script into multiple simpler scripts.
2. Add an error handler with transparent message to every line of code.
3. Add command line options to override hard-coded things, to be able to test things in isolation.
4. Write documentation (man-page) for script, for future self.
5. Write test cases.
6. Refactor code, following best practices.
[0]: http://vlisivka.github.io/bash-modules/
[1]: https://github.com/vlisivka/bash-modules