Sha256: 5f8d4be1d35e5462498389a2a027707af56c79fbd75b7ab5e69951f011f5f4d0
Contents?: true
Size: 972 Bytes
Versions: 2
Compression:
Stored size: 972 Bytes
Contents
#!/usr/bin/env ruby # -*- coding: utf-8 -*- # vim:ft=ruby:enc=utf-8 base_path = ( File.expand_path(File.dirname(__FILE__)+'/..') ) $LOAD_PATH << base_path unless $LOAD_PATH.include?(base_path) require 'optparse' require 'lib/to_pass' # parse options options = { :pipe_usage => ARGV[0].nil?, :algorithm => 'basic_de' } OptionParser.new do |opts| opts.banner = "Usage: #{__FILE__} [options] passphrase" opts.separator "" opts.on('-a', '--algorithm ALGORITM', "use specified algorithm for transformation") do |value| options[:algorithm] = value end opts.separator "" opts.on_tail("-h", "--help", "Show this message") do puts opts exit end end.parse! # get input string string= unless options[:pipe_usage] ARGV[0] else $stdin.read.chomp end # perform "heavy" work password = ToPass::Base.new( string, options[:algorithm] ).to_s if options[:pipe_usage] $stdout << password else puts password end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
to_pass-0.2.3 | bin/to_pass |
to_pass-0.2.2 | bin/to_pass |