Skip to content

Commit

Permalink
* Made delicious-cli more user-friendly
Browse files Browse the repository at this point in the history
* Updated the documentation
* Fixed some bug in the DB
  • Loading branch information
epitron committed Sep 10, 2009
1 parent 1448047 commit 11688f8
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 60 deletions.
78 changes: 48 additions & 30 deletions README.rdoc
Original file line number Diff line number Diff line change
@@ -1,22 +1,49 @@
= Delicious.com Command-line Interface

Locally mirror your delicious links, and search them. Usage:
== Concept

This program lets you locally mirror your delicious links, and quickly search them (with pretty colour-coded results).

Usage:

delicious <search query>
or
dels <search query> (if you're into the brevity thing)

dels <search query>

== Installation

gem sources --add http://gemcutter.org
gem install delicious-cli

== Example:

=== Set your delicious login information:
== Configuration

Just run "delicious" with no options and it will prompt you for your login and password and save the settings to ~/.delicious.


== Commandline options:

Usage: delicious [options] <search query>

Specific options:
-s, --sync Synchronize links
-r, --redownload Erase database and redownload all links
-c, --config Configure login info (set delicious username/password)
-t, --test-auth Test that authentication info works
-d, --debug Debug info

Common options:
-v, --version Version information
-h, --help Show this message


== Common Tasks


(If you have never configured delicious-cli before, this will automatically
happen the first time you run it.)
=== Change your login information:

epi@fizz$ dels -c
epi@fizz$ delicious -c

Delicious login info
---------------------------
Expand All @@ -31,36 +58,27 @@ happen the first time you run it.)
|_ Login successful! Saving config...


=== Download all your delicious links:
=== Download new links (since last update):

epi@fizz$ dels -r

* Redownloading database...
* Retrieving all links... (3465 links found)
* Inserting links into database...done!

=== Download new links (since last sync):

epi@fizz$ dels -s
epi@fizz$ delicious -s

* Synchronizing database...
* Retrieving new links... (5 links found)
* Inserting links into database...done!
|_ Retrieving new links... (5 links found)
|_ Processing links...done!
|_ Saving database...done!

== Commandline options:

=== Clear the database and redownload all links:

Usage: dels [options] <search query>
epi@fizz$ delicious -r

Specific options:
-d, --debug Debug info
-s, --sync Synchronize links
-r, --redownload Erase database and redownload all links
-c, --config Configure app (set delicious username/password)
-t, --test-auth Test that authentication info works
* Redownloading database...
|_ Retrieving all links... (3483 links found)
|_ Processing links...done!
|_ Saving database...done!

Common options:
-h, --help Show this message

== Copyright

Copyright (c) 2009 Chris Gahan. See LICENSE for details.
Copyright (c) 2009 Chris Gahan. See LICENSE for more details.

6 changes: 6 additions & 0 deletions bin/delicious
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env ruby

$:.unshift File.expand_path(File.dirname(__FILE__))

require 'delicious-cli'
main
6 changes: 0 additions & 6 deletions bin/dels

This file was deleted.

1 change: 1 addition & 0 deletions bin/dels
17 changes: 5 additions & 12 deletions delicious-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@

Gem::Specification.new do |s|
s.name = %q{delicious-cli}
s.version = "0.1.4"
s.version = "0.2.0"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["epitron"]
s.date = %q{2009-08-29}
s.default_executable = %q{dels}
s.description = %q{A commandline tool which lets you download all your delicious.com links into a local SQLite database and search them (with pretty color-coded results).}
s.date = %q{2009-09-10}
s.description = %q{A commandline tool which lets you download all your delicious.com links and search them (with pretty color-coded results).}
s.email = %q{[email protected]}
s.executables = ["dels"]
s.executables = ["dels", "delicious"]
s.extra_rdoc_files = [
"LICENSE",
"README.rdoc"
Expand All @@ -29,7 +28,7 @@ Gem::Specification.new do |s|
s.homepage = %q{http://github.com/epitron/delicious-cli}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubygems_version = %q{1.3.3}
s.rubygems_version = %q{1.3.5}
s.summary = %q{Delicious.com commandline interface}
s.test_files = [
"test/delicious-cli_test.rb",
Expand All @@ -41,20 +40,14 @@ Gem::Specification.new do |s|
s.specification_version = 3

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<sequel>, [">= 0"])
s.add_runtime_dependency(%q<httparty>, [">= 0"])
s.add_runtime_dependency(%q<colorize>, [">= 0"])
s.add_runtime_dependency(%q<sqlite3-ruby>, [">= 0"])
else
s.add_dependency(%q<sequel>, [">= 0"])
s.add_dependency(%q<httparty>, [">= 0"])
s.add_dependency(%q<colorize>, [">= 0"])
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
end
else
s.add_dependency(%q<sequel>, [">= 0"])
s.add_dependency(%q<httparty>, [">= 0"])
s.add_dependency(%q<colorize>, [">= 0"])
s.add_dependency(%q<sqlite3-ruby>, [">= 0"])
end
end
24 changes: 14 additions & 10 deletions lib/delicious-cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def redownload
Database.sync
end

def config
def config(first_time = false)
# prompt user and stuff
puts "Delicious login info"
puts "---------------------------"
Expand All @@ -64,6 +64,10 @@ def config
Settings["username"] = username
Settings["password"] = password
Settings.save!

sync if first_time

puts "* Everything is ready. Search away!"
else
puts " |_ Login failed! (Please check your credentials or network.)"
end
Expand All @@ -84,7 +88,7 @@ def main
begin
Settings.load!
rescue Errno::ENOENT
config
config(true)
retry
end

Expand All @@ -96,14 +100,10 @@ def main

options = OpenStruct.new
OptionParser.new do |opts|
opts.banner = "Usage: dels [options] <search query>"
opts.separator ""
opts.banner = "Usage: delicious [options] <search query>"
opts.separator " "
opts.separator "Specific options:"

opts.on("-d", "--debug", "Debug info") do |opt|
options.debug = true
end

opts.on("-s", "--sync", "Synchronize links") do |opt|
options.sync = true
end
Expand All @@ -112,16 +112,20 @@ def main
options.redownload = true
end

opts.on("-c", "--config", "Configure app (set delicious username/password)") do |opt|
opts.on("-c", "--config", "Configure login info (set delicious username/password)") do |opt|
options.config = true
end

opts.on("-t", "--test-auth", "Test that authentication info works") do |opt|
options.test_auth = true
end

opts.on("-d", "--debug", "Debug info") do |opt|
options.debug = true
end


opts.separator ""
opts.separator " "
opts.separator "Common options:"

# No argument, shows at tail. This will print an options summary.
Expand Down
2 changes: 1 addition & 1 deletion lib/delicious-cli/db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def self.init!
end

def self.clear!
File.delete @@filename
File.delete @@filename if File.exists? @@filename
@@posts = []
end

Expand Down
3 changes: 2 additions & 1 deletion lib/delicious-cli/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ def configfile(filename, check=false)
#################################################################

unless File.exists? CONFIGDIR
$log.info "* Creating new config directory: #{CONFIGDIR}"
puts
puts "* Creating new configuration directory: #{CONFIGDIR}"
FileUtils.mkdir_p CONFIGDIR
end

Expand Down

0 comments on commit 11688f8

Please sign in to comment.