chronicle-shell 0.2.1 → 0.2.2
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b88a844a7e429898c8cd9851e9326be1cb1a61cb7fb0598d44456519941d3b9
|
4
|
+
data.tar.gz: 51db09766b5dacf94e4cd92ea5531cdb6475e5afa4759d48acb7e3e8f224cc36
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a4f39726fe053ad6b5341cc5bece31eafb52bfde210fc7cb601cf388b4f7d131d0828d656946f436c455632d9c4f688e3c933f2069fcd55aef7c3204804d9f1
|
7
|
+
data.tar.gz: e4941551b42d16d90ac55345395d7b7bfbd73873a05dde157d129f4add9b0f839a4e55bf90705cd048e3a1c91e261f34aaf346933ebcc948630caf07df179c37
|
@@ -6,10 +6,10 @@ module Chronicle
|
|
6
6
|
register_connector do |r|
|
7
7
|
r.provider = 'shell'
|
8
8
|
r.description = 'shell command history'
|
9
|
-
r.identifier = '
|
9
|
+
r.identifier = 'history'
|
10
10
|
end
|
11
11
|
|
12
|
-
setting :
|
12
|
+
setting :input
|
13
13
|
setting :shell, default: 'bash'
|
14
14
|
|
15
15
|
BASH_TIMESTAMP_REGEX = /^\#(?<timestamp>[0-9]{10})/
|
@@ -37,7 +37,8 @@ module Chronicle
|
|
37
37
|
|
38
38
|
# TODO: modularize the shell-specific stuff
|
39
39
|
def history_filename
|
40
|
-
|
40
|
+
# Ideally we coudl just use ENV['HISTFILE] but it's not available outside of Bash
|
41
|
+
@config.input&.first || __send__("history_filename_default_#{@config.shell}")
|
41
42
|
end
|
42
43
|
|
43
44
|
def history_filename_default_bash
|
@@ -80,13 +81,15 @@ module Chronicle
|
|
80
81
|
end
|
81
82
|
|
82
83
|
def load_commands_from_bash
|
83
|
-
|
84
|
-
File.
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
command = { timestamp: timestamp, command:
|
84
|
+
command = nil
|
85
|
+
File.readlines(history_filename).reverse_each do |line|
|
86
|
+
timestamp_line = line.scrub.match(BASH_TIMESTAMP_REGEX)
|
87
|
+
if timestamp_line && command
|
88
|
+
timestamp = Time.at(timestamp_line[:timestamp].to_i)
|
89
|
+
command = { timestamp: timestamp, command: command }
|
89
90
|
yield command
|
91
|
+
else
|
92
|
+
command = line.scrub.strip
|
90
93
|
end
|
91
94
|
end
|
92
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chronicle-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Louis
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronicle-etl
|
@@ -49,7 +49,7 @@ metadata:
|
|
49
49
|
homepage_uri: https://github.com/chronicle-app/chronicle-shell
|
50
50
|
source_code_uri: https://github.com/chronicle-app/chronicle-shell
|
51
51
|
changelog_uri: https://github.com/chronicle-app/chronicle-shell/releases
|
52
|
-
post_install_message:
|
52
|
+
post_install_message:
|
53
53
|
rdoc_options: []
|
54
54
|
require_paths:
|
55
55
|
- lib
|
@@ -64,8 +64,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
- !ruby/object:Gem::Version
|
65
65
|
version: '0'
|
66
66
|
requirements: []
|
67
|
-
rubygems_version: 3.3.
|
68
|
-
signing_key:
|
67
|
+
rubygems_version: 3.3.3
|
68
|
+
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Shell connectors for Chronicle-ETL
|
71
71
|
test_files: []
|