Implementing logic for CLI