This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby file-ops-v2.rb output --stderr filename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thor' | |
class FileOp < Thor | |
desc 'output FILE_NAME', 'print out the contents of FILE_NAME' | |
option :stderr, :type => :boolean | |
def output(file_name) | |
#options[:stderr] is either true or false depending | |
#on whether or not --stderr was passed | |
contents = File.read(file_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Usage: | |
file_op_v1.rb output FILE_NAME | |
print out the contents of FILE_NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby file-op.rb help output |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thor' | |
class FileOp < Thor | |
desc 'output FILE_NAME', 'print out the contents of FILE_NAME' | |
def output(file_name) | |
puts File.read(file_name) | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Commands: | |
first_steps.rb help [COMMAND] # Describe available commands or one specific command | |
first_steps.rb hi NAME # say hello to NAME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thor' | |
class SayHi < Thor | |
desc "hi NAME", "say hello to NAME" | |
def hi(name) | |
puts "Hi #{name}!" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Getopt::Long; | |
my $data = "file.dat"; | |
my $length = 24; | |
my $verbose; | |
GetOptions("length=i" => \$length, | |
"file=s" => \$data, | |
"verbose" => \$verbose) or die("Error in command line arguments"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (1) | |
{ | |
static struct option long_options[] = | |
{ | |
/* These options set a flag. */ | |
{"verbose", no_argument, &verbose_flag, 1}, | |
{"brief", no_argument, &verbose_flag, 0}, | |
/* These options don't set a flag. | |
We distinguish them by their indices. */ | |
{"add", no_argument, 0, 'a'}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git remote add dokku git@HOSTNAME:APPNAME | |
git push dokku master |