Download Build Awesome Command-Line Applications in Ruby 2: Control by David B. Copeland PDF

By David B. Copeland

Speak on to your procedure. With its easy instructions, flags, and parameters, a well-formed command-line program is the fastest solution to automate a backup, a construct, or a deployment and simplify your lifestyles. With this e-book, you will study particular how you can write command-line purposes which are effortless to take advantage of, installation, and keep, utilizing a collection of transparent most sensible practices and the Ruby programming language. This booklet is designed to make any programmer or approach administrator extra effective of their activity. Now up to date for Ruby 2.

Writing a command-line software that is self-documenting, strong, adaptable and without end helpful is simpler than it's possible you'll imagine. Ruby is especially fitted to this activity, since it combines high-level abstractions with "close to the steel" method interplay wrapped up in a concise, readable syntax. Plus, Ruby has the help of a wealthy atmosphere of open resource instruments and libraries.

Ten insightful chapters every one clarify and display a command-line most sensible perform. you will see how one can use those instruments to raise the lowliest automation script to a maintainable, polished program. you will use unfastened, open resource parsers to create hassle-free command-line interfaces in addition to command suites. you will see how you can use defaults to maintain thoughts easy for daily clients, whereas giving complex clients innovations for extra complicated initiatives. there is no the reason is, a command-line software may still lack documentation, no matter if it really is a part of a support command or a guy web page; you will find out whilst and the way to take advantage of either. Your trip from command-line beginner to professional ends with a glance at worthwhile methods to checking out your apps, and contains a few enjoyable options for outside-the-box, colourful interfaces that might satisfaction your users.

With Ruby, the command line isn't really useless. lengthy dwell the command line.

Show description

Read Online or Download Build Awesome Command-Line Applications in Ruby 2: Control Your Computer, Simplify Your Life PDF

Best protocols & apis books

TCP/IP first-step

TCP/IP First-Step explores TCP/IP techniques in a reader-friendly demeanour that assumes no prior adventure. find out about packetized information move, open networking, reference versions, and criteria our bodies. comprehend the structure of the TCP/IP protocol suite and know about its elements, capabilities, and respective makes use of.

Sams Teach Yourself Networking in 24 Hours (Sams Teach 24 Hours)

Sams train your self Networking in 24 Hours, 3rd Edition
is very informative and extremely good designed to get a begginer in control with the networking ideas.

Principles of Signal Detection and Parameter Estimation

This new textbook is for modern sign detection and parameter estimation classes provided on the complex undergraduate and graduate degrees. It offers a unified remedy of detection difficulties coming up in radar/sonar sign processing and glossy electronic communique platforms. the cloth is complete in scope and addresses sign processing and communique functions with an emphasis on basic rules.

Extra resources for Build Awesome Command-Line Applications in Ruby 2: Control Your Computer, Simplify Your Life

Example text

After that, we’ll discuss commands, which are a distinguishing feature of command suites. grep --ignore-case -r "some string" /tmp Executable Options Arguments Figure 1—Basic parts of a command-line app invocation Options Options are the way in which a user modifies the behavior of your app. Consider the two invocations of ls shown here. In the first, we omit options and see the default behavior. In the second, we use the -l option to modify the listing format. jpg Options come in two forms: long and short.

The filename (without the full path) is the name of our app and what the user will type on the command line to run it, so we want to show only that. Ruby’s File class has a handy method named basename that will give us just the name of the file of our executable, without the path to it, which is exactly what we need to create our banner. banner = "Usage: #{executable_name} [options] database_name" Now the user can easily see that our app requires one argument: the name of the database to back up.

GLI helpfully includes this in our help text, meaning our documentation and our code will always be consistent. We’ve now learned how easy it is to provide help documentation for simple command-line apps and command suites. By adding a few extra strings to our code, our apps can easily help users understand what the apps do and how to use them. But not all apps are so simple. Command-line apps often provide sophisticated behavior that can’t be easily explained in the one or two lines of text available in the built-in help systems.

Download PDF sample

Rated 4.04 of 5 – based on 6 votes