From the course: Code Clinic: Clojure
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Command-line interface - Clojure Tutorial
From the course: Code Clinic: Clojure
Command-line interface
- [Instructor] In this video, we'll complete our solution by adding a command line interface. Inside the namespace declaration, I'll add a require expression. Just need to pull in lakepend dot backend and I'll alias it to BE for backend. This will provide all the functionality we need. Since this is a command line interface, we'll provide a usage string when the arguments aren't provided correctly. I'll go ahead and define that so that we see how the interface will work. I'll call this usage string, and I'll start with usage colon. We'll say, "Must supply two dates "in "three M slash DD slash YYYY format." Let's give them an example. We'll say such as Jan slash oh one slash 2015. We'll also want them to be able to pass dash dash sync to run the sync command, so I'll say, "Or the single argument "dash dash sync." Now we can write our dash main function, which the command line will call. The arguments will be provided from the command line, so we'll need to be able to handle multiple…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.