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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/faktura/cli.rb +23 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef7d89aa79c12ecd72cea01fd8d2a7bbe5517b17
4
- data.tar.gz: b719062a157493c2e99e09e88aaa065c25cc0e24
3
+ metadata.gz: 886679e293bb8e4a40a4824a545ea6783f656949
4
+ data.tar.gz: d20842f18cfc8cce78ad58b5bdb50656b21a0e2d
5
5
  SHA512:
6
- metadata.gz: f9dc88b7dd71ae80ef756bf3b4ad70cd0706aab9dde5a367d354cf36782c39be9f3a651bd88aca43934dacc8217f39169bdbf18f6e0f0afee1a1498d2546a052
7
- data.tar.gz: 1bd76bb3a5cab989f3e491474a42dbc3cb29f9aa93d68518bfb18b112cb56101dc2bd9b03af55c9c069fb9882f6236c3c4e2496c6c3eec9794b537b5fa92d942
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|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faktura
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.12
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcin Koziej