summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2023-09-08 21:16:22 +0300
committerPaul Buetow <paul@buetow.org>2023-09-08 21:16:22 +0300
commit4de55e9b6e77445b2cfd2c7143327cd423603be2 (patch)
tree2cbdaac65e3872a67ed1c05f0855107a71708682
parent6cc5f706dc290f1f314ec1137defa6ff27f9902d (diff)
add more stuff
-rw-r--r--README.md2
-rwxr-xr-xgeheim.rb21
2 files changed, 7 insertions, 16 deletions
diff --git a/README.md b/README.md
index f42d009..cd94a88 100644
--- a/README.md
+++ b/README.md
@@ -15,3 +15,5 @@ This is for my own use. So the documentation here may be lacking. But feel free
* Works on MacOS, Linux and on Android via Termux.
* Clipboard support for MacOS and GNOME (Linux).
* Interactive `geheim` shell support.
+* Can import and export documuments in batches.
+* Can shred exported data again.
diff --git a/geheim.rb b/geheim.rb
index c9024ce..597dbb3 100755
--- a/geheim.rb
+++ b/geheim.rb
@@ -4,7 +4,7 @@ require 'base64'
require 'digest'
require 'digest/sha2'
require 'fileutils'
-require 'io/console'
+# require 'io/console'
require 'openssl'
require 'json'
@@ -50,7 +50,7 @@ module Log
end
def warn(message)
- log "WARN: #{message}"
+ out message, 'WARN'
end
def prompt(message)
@@ -58,7 +58,7 @@ module Log
end
def fatal(message)
- out "FATAL: #{message}", '!'
+ out message, 'FATAL'
exit 3
end
@@ -73,9 +73,6 @@ module Log
puts "#{prefix} #{line}"
end
end
- rescue StandardError => e
- puts e.backtrace
- puts e
end
end
@@ -259,11 +256,7 @@ class GeheimData < CommitFile
@exported_path = nil
@data_path = "#{Config.data_dir}/#{data_file}"
- @data = if data.nil?
- decrypt(encrypted: File.read(@data_path))
- else
- data
- end
+ @data = data.nil? ? decrypt(encrypted: File.read(@data_path)) : data
rescue StandardError => e
fatal e
end
@@ -312,7 +305,6 @@ class Index < CommitFile
@data_file = index_file.sub('.index', '.data')
@index_path = "#{Config.data_dir}/#{index_file}"
@hash = File.basename(index_file).sub('.index', '')
-
@description = description.nil? ? decrypt(encrypted: File.read(@index_path)) : description
end
@@ -664,7 +656,4 @@ class CLI
end
end
-begin
- cli = CLI.new
- exit(cli.shell_loop(ARGV))
-end
+exit(CLI.new.shell_loop(ARGV))