moving cli tool code into its own file