X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=bin%2Fsup-add;h=e27a0ebf6ff446a9347d4fd8937653ab45b97db8;hb=ef1d8a9333f8d261deeb88a7c1cb0cc58d7b6563;hp=50bbb291d4247ef3bea89baeab9ec8f4482c8b25;hpb=a6332191a568f2dd3284570d02bd2ed61c63a4bf;p=sup diff --git a/bin/sup-add b/bin/sup-add index 50bbb29..e27a0eb 100755 --- a/bin/sup-add +++ b/bin/sup-add @@ -77,17 +77,17 @@ end $terminal.wrap_at = :auto Redwood::start -index = Redwood::Index.new +index = Redwood::Index.init -index.lock_or_die +index.lock_interactively or exit begin - index.load_sources + Redwood::SourceManager.load_sources ARGV.each do |uri| labels = $opts[:labels] ? $opts[:labels].split(/\s*,\s*/).uniq : [] - if !$opts[:force_new] && index.source_for(uri) + if !$opts[:force_new] && Redwood::SourceManager.source_for(uri) say "Already know about #{uri}; skipping." next end @@ -99,10 +99,10 @@ begin when "mbox+ssh" say "For SSH connections, if you will use public key authentication, you may leave the username and password blank." say "" - username, password = get_login_info uri, index.sources + username, password = get_login_info uri, Redwood::SourceManager.sources Redwood::MBox::SSHLoader.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels when "imap", "imaps" - username, password = get_login_info uri, index.sources + username, password = get_login_info uri, Redwood::SourceManager.sources Redwood::IMAP.new uri, username, password, nil, !$opts[:unusual], $opts[:archive], nil, labels when "maildir" Redwood::Maildir.new uri, nil, !$opts[:unusual], $opts[:archive], nil, labels @@ -114,7 +114,7 @@ begin Trollop::die "Unknown source type #{parsed_uri.scheme.inspect}" end say "Adding #{source}..." - index.add_source source + Redwood::SourceManager.add_source source end ensure index.save