Deciding Default Behavior
The default behavior is the behavior of our app in the absence of options; for example, db_backup.rb’s default behavior is to compress database backups. Choosing the best default behavior is highly dependent on what your app does; however, there are two behaviors common to many command-line apps: modifying the system and producing output. Let’s look at these two common behaviors to see how we apply our guiding principles to choosing default behavior.
We’ll tackle modifying the system first, because it’s the most common and the most important. By “modifying the system,” we mean the creation, modification, and removal of files. This is where we finally apply our third guiding principle: “Don’t be destructive by default.” ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access