keen-cli 0.1.0 → 0.1.1
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.
- data/Gemfile.lock +1 -1
- data/README.md +14 -10
- data/lib/keen-cli/cli.rb +22 -0
- data/lib/keen-cli/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -17,12 +17,14 @@ $ gem install keen-cli
|
|
17
17
|
Verify the `keen` command is in your path by running it:
|
18
18
|
|
19
19
|
``` shell
|
20
|
-
$ keen
|
21
20
|
Commands:
|
22
|
-
keen
|
23
|
-
keen
|
24
|
-
keen project:
|
25
|
-
keen
|
21
|
+
keen events:add # Add an event
|
22
|
+
keen help [COMMAND] # Describe available commands or one specific command
|
23
|
+
keen project:open # Open the current project
|
24
|
+
keen project:show # Show the current project
|
25
|
+
keen project:workbench # Open the current project's workbench
|
26
|
+
keen queries:run # Run a query
|
27
|
+
keen version # Print the keen-cli version
|
26
28
|
```
|
27
29
|
|
28
30
|
You should see information about available commands.
|
@@ -73,6 +75,7 @@ keen-cli has a variety of commands, and most are namespaced for clarity.
|
|
73
75
|
##### Projects
|
74
76
|
|
75
77
|
* `project:open` - Open the Project Overview page in a browser
|
78
|
+
* `project:workbench` - Open the Project Workbench in a browser
|
76
79
|
* `project:show` - Get data about the project, uses the [project row resource](https://keen.io/docs/api/reference/#project-row-resource).
|
77
80
|
|
78
81
|
##### Events
|
@@ -135,24 +138,25 @@ Some examples:
|
|
135
138
|
|
136
139
|
``` shell
|
137
140
|
# run a count
|
138
|
-
$ keen queries:run -
|
141
|
+
$ keen queries:run --collection cli-tests --analysis-type count
|
142
|
+
1000
|
139
143
|
|
140
144
|
# run a count with collection name from .env
|
141
145
|
# KEEN_COLLECTION_NAME=cli-tests
|
142
|
-
$ keen queries:run -
|
146
|
+
$ keen queries:run --analysis-type count
|
143
147
|
1000
|
144
148
|
|
145
149
|
# run a count with a group by
|
146
|
-
$ keen queries:run -
|
150
|
+
$ keen queries:run --collection cli-tests --analysis-type count --group-by username
|
147
151
|
[
|
148
152
|
{
|
149
|
-
"
|
153
|
+
"username": "dzello",
|
150
154
|
"result": 1000
|
151
155
|
}
|
152
156
|
]
|
153
157
|
|
154
158
|
# run a query with a timeframe, target property, group by, and interval
|
155
|
-
$ keen queries:run
|
159
|
+
$ keen queries:run --collection cli-tests --analysis-type median --target-property value --group-by cohort --timeframe last_24_hours --interval hourly
|
156
160
|
|
157
161
|
{
|
158
162
|
"timeframe": {
|
data/lib/keen-cli/cli.rb
CHANGED
@@ -55,6 +55,17 @@ module KeenCli
|
|
55
55
|
JSON.pretty_generate(JSON.parse(response.to_s)).tap do |s| puts s end
|
56
56
|
end
|
57
57
|
|
58
|
+
desc 'project:collections', 'Show the current project\'s collections'
|
59
|
+
map 'project:collections' => :project_collections
|
60
|
+
shared_options
|
61
|
+
|
62
|
+
def project_collections
|
63
|
+
Utils.process_options!(options)
|
64
|
+
Keen.event_collections.tap do |collections|
|
65
|
+
puts JSON.pretty_generate(collections)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
58
69
|
desc 'project:open', 'Open the current project'
|
59
70
|
map 'project:open' => :project_open
|
60
71
|
shared_options
|
@@ -66,6 +77,17 @@ module KeenCli
|
|
66
77
|
end
|
67
78
|
end
|
68
79
|
|
80
|
+
desc 'project:workbench', 'Open the current project\'s workbench'
|
81
|
+
map 'project:workbench' => :project_workbench
|
82
|
+
shared_options
|
83
|
+
|
84
|
+
def project_workbench
|
85
|
+
Utils.process_options!(options)
|
86
|
+
"https://keen.io/project/#{Keen.project_id}/workbench".tap do |project_url|
|
87
|
+
`open #{project_url}`
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
69
91
|
desc 'queries:run', 'Run a query'
|
70
92
|
map 'queries:run' => :queries_run
|
71
93
|
shared_options
|
data/lib/keen-cli/version.rb
CHANGED