Permalink
Browse files

New option `--credentials` allows you to pass credentials from a YAML…

…-esque file.
  • Loading branch information...
1 parent 0c2c2b8 commit ffb2653c4838b900a08c7aab546d45136ede5131 @mwunsch committed Mar 14, 2010
Showing with 23 additions and 4 deletions.
  1. +0 −1 README.md
  2. +6 −0 bin/tumblr
  3. +17 −3 man/tumblr.1.ronn
View
@@ -101,7 +101,6 @@ To publish to Tumblr, do this:
## TODO:
-+ Add option to CLI for passing a YAML file for authentication, with keys for email & password.
+ File-uploading for Photos, Videos, Audio (needs to get into Weary)
## Copyright
View
@@ -52,6 +52,12 @@ ARGV.options do |option|
publisher[:email] = email
end
+ option.on('--credentials FILE', 'A YAML file with "email" and "password" keys for authentication') do |file|
+ credentials = YAML.load(File.read(file))
+ publisher[:email] = credentials['email']
+ publisher[:password] = credentials['password']
+ end
+
option.on('-p','--publish', 'Publish the post immediately (ignores "state" parameter)') { publish_state = :published }
option.on('-q','--queue', 'Add the post to the queue') { publish_state = :queue }
option.on('-d','--draft', 'Save the post as a draft') { publish_state = :draft }
View
@@ -15,15 +15,18 @@ If you preface your <FILE> with a bit of YAML (<yaml.org>) frontmatter, you can
## OPTIONS
-* `-a`,`--auth` [_EMAIL:PASSWORD_]:
+* `-a`,`--auth` _EMAIL:PASSWORD_:
Provide Email Address and Password, to authenticate to Tumblr, separated by a colon.
If these are not provided, you will be prompted for them.
- You <b>must</b> provide this argument if the post comes from standard input.
+ You <b>must</b> provide this or the `--credentials` argument if the post comes from standard input.
-* `-e`, `--email` [_EMAIL_]:
+* `-e`, `--email` _EMAIL_:
Email Address associated with your Tumblr account.
You will be prompted for a password.
+* `--credentials` _FILE_:
+ A YAML file with the user credentials. Should have keys `email` and `password`.
+
* `-p`,`--publish`:
Publish the post immediately. This will ignore the `state` parameter set in the post.
@@ -62,6 +65,17 @@ Or a Video post:
$ tumblr http://www.youtube.com/watch?v=CW0DUg63lqU
+Save it as a draft:
+
+ $ tumblr -d http://www.youtube.com/watch?v=CW0DUg63lqU
+
+Authenticate with credentials given from a file:
+
+ $ cat ~/.tumblrlogin
+ email: tumblruser@generic-email.com
+ password: myvoiceismypassport
+ $ cat data.yml my_post.txt | tumblr --credentials ~/.tumblrlogin
+
## INSTALLATION
If you have RubyGems installed:

0 comments on commit ffb2653

Please sign in to comment.