Commits

Seth Jackson committed e5cf5bd

Revert allowing the user to specify the password on the command line.

Comments (4)

  1. Trevor Basinger

    Wouldn't it make more sense to have a command line flag to specify what method you want to use?

    For example, say it defaults to "interactive" login but you have the option of using "--password" in the event you want to script with it.

    In my particular case, I am setting up a cron job to backup hourly. Interactive login wouldn't work in this instance.

  2. Seth Jackson author

    The problem with passing a password on the command line is that it will show up in your command history, ~/.bash_history if you have that and if you run it via cron then it will show up in your cron logs. Not good.

    1. Trevor Basinger

      Yeah I agree with that. How about reading an environment variable? That seems about as secure as a config file. Less hassle to code also.

      Also, if you have any goals set or a direction you'd like to see this project move in, I'd like to help you make progress on that.

Files changed (1)

bin/bitbucket-backup

     opts.on("-u", "--username USERNAME", "Required: Username for account to be backed up") do |username|
         options[:username] = username
     end
-    
-    opts.on("-p", "--password PASSWORD", "Required: Password for account to be backed up") do |password|
-        options[:password] = password
-    end
 end
 
 parser.parse!
 
-if ARGV.empty? || !options[:password] || !options[:username]
+if ARGV.empty? || !options[:username]
     puts parser.banner
     exit
 end
 
+options[:password] = ask("Password: ") do |q|
+    q.echo = false
+end
+
 Bitbucket::Backup.run(options[:username], options[:password], ARGV.first, options[:all_repos])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.