Learn how to create a command-line interface for the program.
- [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 error D.…Easy way to do this is to use the ampersand and then args.…
Skill Level Intermediate
1. Problem 1: Exploring Lake Pend Oreille
2. Problem 2: Image Analysis
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Recursion and Directories
6. Problem 6: Building the Web
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.