faktura 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/faktura/cli.rb +23 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 886679e293bb8e4a40a4824a545ea6783f656949
|
4
|
+
data.tar.gz: d20842f18cfc8cce78ad58b5bdb50656b21a0e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44847e638936981b62ee5181a61fcc0e37aaa00ac08a58eeda590a817a3fe986551439cf1b48045006d066230e66c8ca2263e7654954be7b020330448fcdf218
|
7
|
+
data.tar.gz: cbda794bdb356a0673885c232109668587c2ff880403453b9b6a78143c158adbd1c3146228b854971a035c53b55c91a263cc00fbcb4608634904745eaf0f9d6e
|
data/lib/faktura/cli.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# coding: utf-8
|
1
2
|
|
2
3
|
module Faktura
|
3
4
|
class CLI < Clamp::Command
|
@@ -8,9 +9,31 @@ module Faktura
|
|
8
9
|
option ['-p', '--printer'], 'PRINTER', 'print (stamped) invoice'
|
9
10
|
option ['-o', '--open'], :flag, 'open (stamped) invoice'
|
10
11
|
option ['-w', '--window'], :flag, 'Ask using a dialog window'
|
12
|
+
option ['-I', '--install'], :flag, 'Install right-click shortcuts'
|
11
13
|
parameter 'names ...', 'files or directories', attribute_name: :names
|
12
14
|
|
13
15
|
def execute
|
16
|
+
if install?
|
17
|
+
require 'fileutils'
|
18
|
+
nautilus_dir = File.expand_path("~/.local/share/nautilus/scripts")
|
19
|
+
FileUtils.mkdir_p nautilus_dir
|
20
|
+
|
21
|
+
nautilus_script = File.expand_path(names[0], nautilus_dir)
|
22
|
+
open(nautilus_script, "w") do |f|
|
23
|
+
f.write <<END
|
24
|
+
#!/bin/bash
|
25
|
+
|
26
|
+
set -e
|
27
|
+
set -u
|
28
|
+
|
29
|
+
faktura -swo "$1"
|
30
|
+
END
|
31
|
+
end
|
32
|
+
File.chmod(0755, nautilus_script)
|
33
|
+
return
|
34
|
+
end
|
35
|
+
|
36
|
+
|
14
37
|
names.each do |name|
|
15
38
|
if directory?
|
16
39
|
Dir["#{name}/**/*.pdf"].each do |fn|
|