sup 0.19.0 → 0.22.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -0
  3. data/.gitmodules +3 -0
  4. data/.travis.yml +3 -2
  5. data/CONTRIBUTORS +19 -13
  6. data/Gemfile +4 -0
  7. data/History.txt +41 -0
  8. data/Rakefile +41 -1
  9. data/ReleaseNotes +17 -0
  10. data/bin/sup +5 -18
  11. data/bin/sup-add +1 -2
  12. data/bin/sup-config +0 -1
  13. data/bin/sup-dump +0 -1
  14. data/bin/sup-import-dump +1 -2
  15. data/bin/sup-sync +0 -1
  16. data/bin/sup-sync-back-maildir +1 -2
  17. data/bin/sup-tweak-labels +1 -2
  18. data/contrib/colorpicker.rb +0 -2
  19. data/contrib/completion/_sup.bash +102 -0
  20. data/devel/profile.rb +0 -1
  21. data/ext/mkrf_conf_xapian.rb +47 -0
  22. data/lib/sup.rb +9 -8
  23. data/lib/sup/buffer.rb +12 -0
  24. data/lib/sup/colormap.rb +5 -2
  25. data/lib/sup/contact.rb +4 -2
  26. data/lib/sup/crypto.rb +41 -8
  27. data/lib/sup/draft.rb +8 -8
  28. data/lib/sup/hook.rb +1 -1
  29. data/lib/sup/index.rb +2 -2
  30. data/lib/sup/label.rb +1 -1
  31. data/lib/sup/maildir.rb +16 -5
  32. data/lib/sup/mbox.rb +13 -5
  33. data/lib/sup/message.rb +17 -3
  34. data/lib/sup/message_chunks.rb +10 -2
  35. data/lib/sup/mode.rb +33 -28
  36. data/lib/sup/modes/edit_message_mode.rb +3 -2
  37. data/lib/sup/modes/forward_mode.rb +22 -3
  38. data/lib/sup/modes/line_cursor_mode.rb +1 -1
  39. data/lib/sup/modes/text_mode.rb +6 -1
  40. data/lib/sup/modes/thread_index_mode.rb +11 -1
  41. data/lib/sup/modes/thread_view_mode.rb +103 -9
  42. data/lib/sup/person.rb +68 -61
  43. data/lib/sup/search.rb +1 -1
  44. data/lib/sup/sent.rb +1 -1
  45. data/lib/sup/util.rb +1 -75
  46. data/lib/sup/util/locale_fiddler.rb +24 -0
  47. data/lib/sup/version.rb +1 -1
  48. data/sup.gemspec +22 -5
  49. data/test/{messages → fixtures}/bad-content-transfer-encoding-1.eml +0 -0
  50. data/test/{messages → fixtures}/binary-content-transfer-encoding-2.eml +0 -0
  51. data/test/fixtures/blank-header-fields.eml +71 -0
  52. data/test/fixtures/contacts.txt +1 -0
  53. data/test/fixtures/malicious-attachment-names.eml +55 -0
  54. data/test/fixtures/missing-from-to.eml +18 -0
  55. data/test/{messages → fixtures}/missing-line.eml +0 -0
  56. data/test/fixtures/multi-part-2.eml +72 -0
  57. data/test/fixtures/multi-part.eml +61 -0
  58. data/test/fixtures/no-body.eml +18 -0
  59. data/test/fixtures/simple-message.eml +29 -0
  60. data/test/gnupg_test_home/gpg.conf +2 -1
  61. data/test/gnupg_test_home/key1.gen +15 -0
  62. data/test/gnupg_test_home/key2.gen +15 -0
  63. data/test/gnupg_test_home/key_ecc.gen +13 -0
  64. data/test/gnupg_test_home/pubring.gpg +0 -0
  65. data/test/gnupg_test_home/receiver_pubring.gpg +0 -0
  66. data/test/gnupg_test_home/receiver_secring.gpg +0 -0
  67. data/test/gnupg_test_home/regen_keys.sh +38 -0
  68. data/test/gnupg_test_home/secring.gpg +0 -0
  69. data/test/gnupg_test_home/sup-test-2@foo.bar.asc +22 -17
  70. data/test/integration/test_maildir.rb +75 -0
  71. data/test/integration/test_mbox.rb +69 -0
  72. data/test/test_crypto.rb +12 -2
  73. data/test/test_header_parsing.rb +1 -1
  74. data/test/test_helper.rb +6 -3
  75. data/test/test_message.rb +42 -342
  76. data/test/test_messages_dir.rb +4 -28
  77. data/test/test_yaml_regressions.rb +1 -1
  78. data/test/unit/test_contact.rb +33 -0
  79. data/test/unit/test_locale_fiddler.rb +15 -0
  80. data/test/unit/test_person.rb +37 -0
  81. metadata +108 -38
  82. data/test/gnupg_test_home/receiver_trustdb.gpg +0 -0
  83. data/test/gnupg_test_home/trustdb.gpg +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d330a3455ed22952d8c45fce0f6a0d69346c40f2
4
- data.tar.gz: 337b95be43bc301f6180b542b2395df025f4f1db
3
+ metadata.gz: 703c8b0175724e4a3a4965081e8a0b12fb01147a
4
+ data.tar.gz: 86557dfd9de2f477dbf4f8322cd732c221d51c9d
5
5
  SHA512:
6
- metadata.gz: f538e3054ba742a5fadd296bcb6d29b0295e3ca807a0dfe600d908b3cfa9602697bd4e422ac5bde8facb603fe12784add4709ccc4f5ca9b7b76bf348cec3a6f3
7
- data.tar.gz: 1923d32e3cfc13998e52bc7c53b19482f6a4ed9b13d4e79880a1a6a16d926b26af2e6aaa73d1ea6556a6d2cdaf51aae1979afc51eff01697df9801dd787a45a3
6
+ metadata.gz: ba46b62b4cd8059cd1835624270e715da259934f4f497f56471e81bd02876b83518c8b647ed4c1d0f43520f0a42fcdbec500b6a8b1abb4002bfdea7fe5e44ddd
7
+ data.tar.gz: 0e5f694ae6cd39770120ef26163a68bddb8179baa6cbcaec87acdbee17be1627cc9520c802427dd5f4958c7d367017034cf62360acddedef27f8a95d27b288cf
data/.gitignore CHANGED
@@ -4,6 +4,7 @@
4
4
  *~
5
5
  # artifact
6
6
  pkg/
7
+ man/
7
8
  *.gem
8
9
  # i have accidently added this one one too many times
9
10
  sup-exception-log.txt
@@ -14,4 +15,8 @@ Gemfile.lock
14
15
 
15
16
  # generated file for gnupg test
16
17
  test/gnupg_test_home/random_seed
18
+ test/gnupg_test_home/trustdb.gpg
19
+ test/gnupg_test_home/.gpg-v21-migrated
20
+ test/gnupg_test_home/private-keys-v1.d
21
+
17
22
 
@@ -0,0 +1,3 @@
1
+ [submodule "doc/wiki"]
2
+ path = doc/wiki
3
+ url = https://github.com/sup-heliotrope/sup.wiki.git
@@ -3,10 +3,11 @@ language: ruby
3
3
  rvm:
4
4
  - 2.1.1
5
5
  - 2.0.0
6
- - 1.9.3
6
+ - 2.2.0
7
7
 
8
8
  before_install:
9
9
  - sudo apt-get update -qq
10
- - sudo apt-get install -qq uuid-dev uuid libncursesw5-dev libncursesw5 gnupg2
10
+ - sudo apt-get install -qq uuid-dev uuid libncursesw5-dev libncursesw5 gnupg2 pandoc
11
+ - git submodule update --init --recursive
11
12
 
12
13
  script: bundle exec rake travis
@@ -3,28 +3,31 @@ Rich Lane
3
3
  Gaute Hope <eg at the gaute.vetsj dot coms>
4
4
  Whyme Lyu <callme5long at the gmail dot coms>
5
5
  Hamish Downer <dmishd at the gmail dot coms>
6
+ Zeger-Jan van de Weg <mail at the zjvandeweg dot nls>
6
7
  Damien Leone <damien.leone at the fensalir dot frs>
7
8
  Sascha Silbe <sascha-pgp at the silbe dot orgs>
8
9
  Eric Weikl <eric.weikl at the gmx dot nets>
9
10
  Paweł Wilk <siefca at the gnu dot orgs>
10
11
  Ismo Puustinen <ismo at the iki dot fis>
12
+ Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
11
13
  Nicolas Pouillard <nicolas.pouillard at the gmail dot coms>
12
14
  Michael Stapelberg <michael at the stapelberg dot des>
13
15
  Eric Sherman <hyperbolist at the gmail dot coms>
14
16
  Tero Tilus <tero at the tilus dot nets>
15
17
  Ben Walton <bwalton at the artsci.utoronto dot cas>
18
+ Scott Bonds <scott at the ggr dot coms>
16
19
  Mike Stipicevic <stipim at the rpi dot edus>
17
20
  Martin Bähr <mbaehr at the societyserver dot orgs>
21
+ Timon Vonk <timonv at the gmail dot coms>
18
22
  Clint Byrum <clint at the ubuntu dot coms>
19
23
  Wael M. Nasreddine <wael.nasreddine at the gmail dot coms>
20
24
  Marcus Williams <marcus-sup at the bar-coded dot nets>
21
- Matthieu Rakotojaona <matthieu.rakotojaona at the gmail dot coms>
22
25
  Lionel Ott <white.magic at the gmx dot des>
23
26
  Gaudenz Steinlin <gaudenz at the soziologie dot chs>
24
- Ingmar Vanhassel <ingmar at the exherbo dot orgs>
27
+ Per Andersson <avtobiff at the gmail dot coms>
25
28
  Mark Alexander <marka at the pobox dot coms>
29
+ Ingmar Vanhassel <ingmar at the exherbo dot orgs>
26
30
  Edward Z. Yang <ezyang at the mit dot edus>
27
- Timon Vonk <timonv at the gmail dot coms>
28
31
  julien@macbook <julien.stechele at the gmail dot coms>
29
32
  Christopher Warrington <chrisw at the rice dot edus>
30
33
  W. Trevor King <wking at the drexel dot edus>
@@ -37,8 +40,8 @@ Markus Klinik
37
40
  Bo Borgerson <gigabo at the gmail dot coms>
38
41
  Atte Kojo <atte.kojo at the reaktor dot fis>
39
42
  Michael Hamann <michael at the content-space dot des>
40
- William Erik Baxter <web at the superscript dot coms>
41
43
  Jonathan Lassoff <jof at the thejof dot coms>
44
+ William Erik Baxter <web at the superscript dot coms>
42
45
  Grant Hollingworth <grant at the antiflux dot orgs>
43
46
  Ico Doornekamp <ico at the pruts dot nls>
44
47
  Adeodato Simó <dato at the net.com.org dot ess>
@@ -48,6 +51,7 @@ Jason Petsod
48
51
  Robin Burchell <viroteck at the viroteck dot nets>
49
52
  Steve Goldman <sgoldman at the tower-research dot coms>
50
53
  Peter Harkins <ph at the malaprop dot orgs>
54
+ rjg-vB <rthrd at the web dot des>
51
55
  Decklin Foster <decklin at the red-bean dot coms>
52
56
  Cameron Matheson <cam+sup at the cammunism dot orgs>
53
57
  Carl Worth <cworth at the cworth dot orgs>
@@ -56,29 +60,31 @@ Andrew Pimlott
56
60
  Jeff Balogh <its.jeff.balogh at the gmail dot coms>
57
61
  Matías Aguirre <matiasaguirre at the gmail dot coms>
58
62
  PaulSmecker <paul.smecker at the gmail dot coms>
63
+ Ruthard Baudach <rthrd at the web dot des>
59
64
  Kornilios Kourtis <kkourt at the cslab.ece.ntua dot grs>
60
65
  Lars Fischer <fischer at the wiwi.uni-siegen dot des>
61
66
  madhat2r <MaDhAt2r at the dukefoo dot coms>
62
- Giorgio Lando <patroclo7 at the gmail dot coms>
63
67
  Kevin Riggle <kevinr at the free-dissociation dot coms>
68
+ Giorgio Lando <patroclo7 at the gmail dot coms>
64
69
  Benoît PIERRE <benoit.pierre at the gmail dot coms>
65
- Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
66
70
  Steven Lawrance <stl at the koffein dot nets>
71
+ Alvaro Herrera <alvherre at the alvh.no-ip dot orgs>
67
72
  Jonah <Jonah at the GoodCoffee dot cas>
68
73
  ian <itaylor at the uark dot edus>
69
- Adam Lloyd <adam at the alloy-d dot nets>
74
+ Elias Norberg <xyzzy at the kudzu dot ses>
75
+ 0xACE <0xACE at the users.noreply.github dot coms>
70
76
  MichaelRevell <mikearevell at the gmail dot coms>
71
77
  Gregor Hoffleit <gregor at the sam.mediasupervision dot des>
78
+ Adam Lloyd <adam at the alloy-d dot nets>
72
79
  Todd Eisenberger <teisenbe at the andrew.cmu dot edus>
73
- Per Andersson <avtobiff at the gmail dot coms>
74
- 0xACE <0xACE at the users.noreply.github dot coms>
80
+ Johannes Larsen <mail at the johslarsen dot nets>
81
+ Sharif Olorin <sio at the tesser dot orgs>
75
82
  Steven Schmeiser <steven at the schmeiser dot orgs>
76
83
  Steven Walter <swalter at the monarch.(none)>
77
- Jon M. Dugan <jdugan at the es dot nets>
78
- akojo <atte.kojo at the gmail dot coms>
79
- Matthias Vallentin <vallentin at the icir dot orgs>
80
84
  William A. Kennington III <william at the wkennington dot coms>
85
+ akojo <atte.kojo at the gmail dot coms>
81
86
  Horacio Sanson <horacio at the skillupjapan.co dot jps>
87
+ Matthias Vallentin <vallentin at the icir dot orgs>
88
+ Jon M. Dugan <jdugan at the es dot nets>
82
89
  Stefan Lundström <lundst at the snabb.(none)>
83
- Johannes Larsen <johs.a.larsen at the gmail dot coms>
84
90
  Kirill Smelkov <kirr at the landau.phys.spbu dot rus>
data/Gemfile CHANGED
@@ -1,3 +1,7 @@
1
1
  source 'https://rubygems.org/'
2
2
 
3
+ if !RbConfig::CONFIG['arch'].include?('openbsd')
4
+ gem 'xapian-ruby', '~> 1.2.15'
5
+ end
6
+
3
7
  gemspec
@@ -1,3 +1,44 @@
1
+ == 0.22.1 / 2015-06-18
2
+
3
+ * Fix bug (#429) in gem build / install.
4
+
5
+ == 0.22.0 / 2015-06-16
6
+
7
+ * Use mime-types 2
8
+ * Fix ruby style (Zeger-Jan van de Weg)
9
+ * Johannes Larsen: fix long-standing bug with draft-id mixups causing
10
+ drafts to disappear.
11
+ * Various bugs and minor improvements.
12
+
13
+ == 0.21.0 / 2015-02-12
14
+
15
+ * Key binding to fetch GPG key from keyserver (Matthieu Rakotojaona)
16
+ * Replace occurences of File.exists? with File.exist? (Zeger-Jan van de
17
+ Weg)
18
+ * You can now unsubscribe from mailinglists using an url, if you have a
19
+ goto-hook setup (Timon Vonk).
20
+ * Forward attribution can be customized using the forward-attribution
21
+ hook (Ruthard Baudach)
22
+ * Do a few more checks for buffer not nil in the hope to fix a few
23
+ random crashes
24
+ * Add bash completion (Per Andersson)
25
+ * Replace dl/import with Fiddle (Timon Vonk)
26
+ * Drop support for ruby 1.9.3
27
+ * Add tests for contact manager and persons (Zeger-Jan van de Weg)
28
+
29
+ == 0.20.0 / 2014-10-06
30
+
31
+ * add man-pages (generated from wiki) (Per Andersson)!
32
+ * HTML messages or messages that are decoded with the mime-decode hook
33
+ are now indexed if the mime-decode hook is set up (Scott Bonds).
34
+ * OpenBSD support (Scott Bonds)!
35
+ * goto-hook for keybinding to open URLs.
36
+ * support special charaters in source URIs (Scott Bonds).
37
+ * output message id and locations on all load_from_source failures
38
+ * fix long-standing getlocal bug
39
+ * make new test GPG keys (old ones expired), valid for one year, script
40
+ now available in devel/ for making new ones.
41
+
1
42
  == 0.19.0 / 2014-07-05
2
43
 
3
44
  * new check-attachment hook
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'rubygems'
2
1
  require 'rake/testtask'
3
2
  require "bundler/gem_tasks"
4
3
 
@@ -9,4 +8,45 @@ Rake::TestTask.new(:test) do |test|
9
8
  end
10
9
  task :default => :test
11
10
 
11
+ task :build => [:man]
12
12
  task :travis => [:test, :build]
13
+
14
+ def test_pandoc
15
+ return system("pandoc -v > /dev/null 2>&1")
16
+ end
17
+
18
+ task :man do
19
+ puts "building manpages from wiki.."
20
+ unless test_pandoc
21
+ puts "no pandoc installed, needed for manpage generation."
22
+ return
23
+ end
24
+
25
+ # test if wiki is cloned
26
+ unless Dir.exist? 'doc/wiki/man'
27
+ puts "wiki git repository is not cloned in doc/wiki, try: git submodule update --init."
28
+ return
29
+ end
30
+
31
+ unless Dir.exist? 'man'
32
+ Dir.mkdir 'man'
33
+ end
34
+
35
+ Dir.glob("doc/wiki/man/*.md").each do |md|
36
+ m = /^.*\/(?<manpage>[^\/]*)\.md$/.match(md)[:manpage]
37
+ puts "generating manpage for: #{m}.."
38
+ r = system "pandoc -s -f markdown -t man #{md} -o man/#{m}"
39
+
40
+ unless r
41
+ puts "failed to generate manpage: #{m}."
42
+ return
43
+ end
44
+ end
45
+ end
46
+
47
+ task :clean do
48
+ ['man', 'pkg'].each do |d|
49
+ puts "cleaning #{d}.."
50
+ FileUtils.rm_r d if Dir.exist? d
51
+ end
52
+ end
@@ -1,3 +1,20 @@
1
+ Release 0.21.0:
2
+
3
+ Several small features as well as polishing (including fetching a GPG key with
4
+ a shortcut and unsubscribing from mailinglist using an url). Several old
5
+ deprecated parts of sup have been modernized. Support for Ruby 1.9.3 has been
6
+ dropped. Have a look in History.txt for the details.
7
+
8
+ Release 0.20.0:
9
+
10
+ We've got man pages (Mr. Andersson)! We've got OpenBSD support (Scott Bonds)!
11
+ It is now possible to get your HTML emails indexed by setting up a mime-decode
12
+ hook before you index (Scott Bonds)! Scott Bonds also fixed up special character handing in source URIs. It is now possible to set up a goto hook
13
+ for opening the URL below the cursor.
14
+
15
+ Also a few long standing bugs have been fixed, and new GPG keys have been made
16
+ for the tests.
17
+
1
18
  Release 0.19.0:
2
19
 
3
20
  New hook: check-attachment and a new option to shows dates in 24h format.
data/bin/sup CHANGED
@@ -3,10 +3,10 @@
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
5
5
 
6
- require 'rubygems'
7
6
  require 'ncursesw'
8
7
 
9
8
  require 'sup/util/ncurses'
9
+ require 'sup/util/locale_fiddler'
10
10
 
11
11
  no_gpgme = false
12
12
  begin
@@ -102,27 +102,14 @@ global_keymap = Keymap.new do |k|
102
102
  end
103
103
  end
104
104
 
105
- ## the following magic enables wide characters when used with a ruby
106
- ## ncurses.so that's been compiled against libncursesw. (note the w.) why
107
- ## this works, i have no idea. much like pretty much every aspect of
108
- ## dealing with curses. cargo cult programming at its best.
109
- require 'dl/import'
110
105
  require 'rbconfig'
111
- module LibC
112
- extend DL.const_defined?(:Importer) ? DL::Importer : DL::Importable
113
- setlocale_lib = case RbConfig::CONFIG['arch']
114
- when /darwin/; "libc.dylib"
115
- when /cygwin/; "cygwin1.dll"
116
- when /freebsd/; "libc.so.7"
117
- else; "libc.so.6"
118
- end
119
106
 
120
- debug "dynamically loading setlocale() from #{setlocale_lib}"
107
+ unless RbConfig::CONFIG['arch'] =~ /openbsd/
108
+ debug "dynamically loading setlocale()"
121
109
  begin
122
- dlload setlocale_lib
123
- extern "void setlocale(int, const char *)"
110
+ class LibC; extend LocaleFiddler; end
124
111
  debug "setting locale..."
125
- LibC.setlocale(6, "") # LC_ALL == 6
112
+ LibC.setlocale(6, "")
126
113
  rescue RuntimeError => e
127
114
  warn "cannot dlload setlocale(); ncurses wide character support probably broken."
128
115
  warn "dlload error was #{e.class}: #{e.message}"
@@ -3,7 +3,6 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
6
  require 'highline/import'
8
7
  require 'trollop'
9
8
  require "sup"
@@ -95,7 +94,7 @@ begin
95
94
  next
96
95
  end
97
96
 
98
- parsed_uri = URI(uri)
97
+ parsed_uri = URI(URI.escape(uri))
99
98
 
100
99
  source =
101
100
  case parsed_uri.scheme
@@ -2,7 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
- require 'rubygems'
6
5
  require 'highline/import'
7
6
  require 'trollop'
8
7
  require "sup"
@@ -2,7 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
- require 'rubygems'
6
5
  require 'xapian'
7
6
  require 'trollop'
8
7
  require 'set'
@@ -3,7 +3,6 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
6
  require 'trollop'
8
7
  require "sup"
9
8
 
@@ -82,7 +81,7 @@ begin
82
81
  next if opts[:dry_run]
83
82
 
84
83
  m.labels = new_labels
85
- index.update_message_state m
84
+ index.update_message_state [m, false]
86
85
  end
87
86
 
88
87
  index.commit_transaction if opts[:atomic]
@@ -3,7 +3,6 @@
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
5
  require 'uri'
6
- require 'rubygems'
7
6
  require 'trollop'
8
7
  require "sup"
9
8
 
@@ -3,7 +3,6 @@
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
5
5
 
6
- require 'rubygems'
7
6
  require 'trollop'
8
7
  require "sup"
9
8
 
@@ -60,7 +59,7 @@ $config[:sync_back_to_maildir] = true
60
59
 
61
60
  begin
62
61
  sync_performed = []
63
- sync_performed = File.readlines(Redwood::SYNC_OK_FN).collect { |e| e.strip }.find_all { |e| not e.empty? } if File.exists? Redwood::SYNC_OK_FN
62
+ sync_performed = File.readlines(Redwood::SYNC_OK_FN).collect { |e| e.strip }.find_all { |e| not e.empty? } if File.exist? Redwood::SYNC_OK_FN
64
63
  sources = []
65
64
 
66
65
  ## Try to find out sources given in parameters
@@ -2,7 +2,6 @@
2
2
 
3
3
  $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
4
 
5
- require 'rubygems'
6
5
  require 'trollop'
7
6
  require "sup"
8
7
 
@@ -83,7 +82,7 @@ begin
83
82
  ## query to only messages with those labels
84
83
  query += " (" + remove_labels.map { |l| "label:#{l}" }.join(" OR ") + ")"
85
84
  end
86
- query += ' ' + opts[:query] if opts[:query]
85
+ query += ' AND ' + opts[:query] if opts[:query]
87
86
 
88
87
  parsed_query = index.parse_query query
89
88
  parsed_query.merge! :load_spam => true, :load_deleted => true, :load_killed => true
@@ -1,5 +1,3 @@
1
- require 'rubygems'
2
-
3
1
  require 'ncursesw'
4
2
 
5
3
  Ncurses.initscr
@@ -0,0 +1,102 @@
1
+ # Sup Bash completion
2
+ #
3
+ # * Complete options for all Sup commands.
4
+ # * Disable completion for next option when current option takes an argument.
5
+ # * Complete sources, directories, and files, where applicable.
6
+
7
+ _sup_cmds() {
8
+ local cur prev opts sources
9
+ COMPREPLY=()
10
+ cur="${COMP_WORDS[COMP_CWORD]}"
11
+ prev="${COMP_WORDS[COMP_CWORD-1]}"
12
+ sources="$(sed -n '/uri:/ {s/.*uri:\s*//p}' $HOME/.sup/sources.yaml)"
13
+
14
+ case "${1##/*}" in
15
+ sup-add)
16
+ opts="--archive -a --unusual -u --sync-back --no-sync-back -s
17
+ --labels -l --force-new -f --force-account -o --version -v
18
+ --help -h mbox: maildir:"
19
+
20
+ case $prev in
21
+ --labels|-l|--force-account|-o)
22
+ COMPREPLY=()
23
+ return 0
24
+ ;;
25
+ esac
26
+ ;;
27
+ sup-config|sup-dump)
28
+ opts="--version -v --help -h"
29
+ ;;
30
+ sup-import-dump)
31
+ opts="--verbose -v --ignore-missing -i --warn-missing -w
32
+ --abort-missing -a --atomic -t --dry-run -n --version --help
33
+ -h"
34
+ ;;
35
+ sup)
36
+ opts="--list-hooks -l --no-threads -n --no-initial-poll -o --search
37
+ -s --compose -c --subject -j --version -v --help -h"
38
+
39
+ case $prev in
40
+ --search|-s|--compose|-c|--subject|-j)
41
+ COMPREPLY=()
42
+ return 0
43
+ ;;
44
+ esac
45
+ ;;
46
+ sup-recover-sources)
47
+ opts="--unusual --archive --scan-num --help -h $sources"
48
+
49
+ case $prev in
50
+ --scan-num)
51
+ COMPREPLY=()
52
+ return 0
53
+ ;;
54
+ esac
55
+ ;;
56
+ sup-sync)
57
+ opts="--asis --restore --discard --archive -x --read -r
58
+ --extra-labels --verbose -v --optimize -o --all-sources
59
+ --dry-run -n --version --help -h ${sources}"
60
+
61
+
62
+ case $prev in
63
+ --restore|--extra-labels)
64
+ COMPREPLY=()
65
+ return 0
66
+ ;;
67
+ esac
68
+ ;;
69
+ sup-sync-back-maildir)
70
+ maildir_sources="$(echo $sources | tr ' ' '\n' | grep maildir)"
71
+ opts="--no-confirm -n --no-merge -m --list-sources -l
72
+ --unusual-sources-too -u --version -v --help -h
73
+ $maildir_sources"
74
+ ;;
75
+ sup-tweak-labels)
76
+ opts="--add -a --remove -r --query -q --verbose -v --very-verbose
77
+ -e --all-sources --dry-run -n --no-sync-back -o --version
78
+ --help -h $sources"
79
+
80
+ case $prev in
81
+ --add|-a|--remove|-r|--query|-q)
82
+ COMPREPLY=()
83
+ return 0
84
+ ;;
85
+ esac
86
+ ;;
87
+ esac
88
+
89
+ COMPREPLY=( $(compgen -W "$opts" -- ${cur}) )
90
+ return 0
91
+ }
92
+
93
+ complete -F _sup_cmds sup \
94
+ sup-add \
95
+ sup-config \
96
+ sup-dump \
97
+ sup-recover-sources \
98
+ sup-sync \
99
+ sup-sync-back-maildir \
100
+ sup-tweak-labels
101
+
102
+ complete -F _sup_cmds -o filenames -o plusdirs sup-import-dump