discourse_cli 0.3.0 → 0.4.0
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/CHANGELOG.md +4 -0
- data/README.md +15 -0
- data/discourse_cli-0.3.0.gem +0 -0
- data/lib/discourse_cli/cli.rb +22 -5
- data/lib/discourse_cli/version.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd08a18ef237040b7897b7b04b27b2394e31a072
|
4
|
+
data.tar.gz: e7e576fa93fa2b4c92455dec605b8a3dd22a5465
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a91614235bb4b38d5d0803e75be2af6e3a30b110442b0de8d1425f45943d543fc1c130f50879294a3118fe5a9d40abb818587c7e4f42205118f785419fe3602
|
7
|
+
data.tar.gz: 0dfc858e89c01d511e864eed7642aa402145a644df7b577a8eea5c169d0c2aca97eb776a49cd2b9965500d25c1b2019905196c0e65a091b8fc68fa91726af429
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.4.0] - 2016-05-02
|
6
|
+
### Added
|
7
|
+
- added `sub_categories` command
|
8
|
+
|
5
9
|
## [0.3.0] - 2015-11-28
|
6
10
|
### Added
|
7
11
|
- added `posts` command
|
data/README.md
CHANGED
@@ -31,6 +31,7 @@ Type `discourse` to see a list of available commands:
|
|
31
31
|
Commands:
|
32
32
|
discourse categories # returns a list of categories
|
33
33
|
discourse help [COMMAND] # Describe available commands or one specific command
|
34
|
+
discourse posts TOPIC_ID # returns a list of posts in the specified topic
|
34
35
|
discourse topics CATEGORY_SLUG # returns a list of all the topics in the specified category
|
35
36
|
|
36
37
|
To see a list of categories:
|
@@ -62,6 +63,20 @@ To see a list of topics in a category:
|
|
62
63
|
214 Rzageqphtbcnsfmxudlwiokjvy
|
63
64
|
213 Afngbetiqovyxjpwklsczhdrmu
|
64
65
|
|
66
|
+
To see a list of posts in a topic:
|
67
|
+
|
68
|
+
$ discourse posts 232 | head
|
69
|
+
|
70
|
+
244 ofvwgejxuld...
|
71
|
+
245 nukegjtadmr...
|
72
|
+
246 hcqobgwupdy...
|
73
|
+
247 segjvdfhzxy...
|
74
|
+
248 uxmjkpngolw...
|
75
|
+
249 bufahjmozwx...
|
76
|
+
250 gkuhraztsmx...
|
77
|
+
251 izqdervkoyc...
|
78
|
+
252 sroquzpyfml...
|
79
|
+
253 hzkywjqsuit...
|
65
80
|
|
66
81
|
More commands coming soon!
|
67
82
|
|
Binary file
|
data/lib/discourse_cli/cli.rb
CHANGED
@@ -16,6 +16,13 @@ module DiscourseCli
|
|
16
16
|
puts "#{c['id']} #{c['name']} #{c['slug']}"
|
17
17
|
end
|
18
18
|
end
|
19
|
+
|
20
|
+
desc "sub_categories PARENT_CATEGORY_ID", "returns a list of sub-categories in the specified category"
|
21
|
+
def sub_categories(parent_category_id)
|
22
|
+
client = DiscourseCli::Client.client
|
23
|
+
results = client.categories(parent_category_id: parent_category_id)
|
24
|
+
puts results
|
25
|
+
end
|
19
26
|
|
20
27
|
desc "topics CATEGORY_SLUG", "returns a list of all the topics in the specified category"
|
21
28
|
def topics(category_slug)
|
@@ -26,14 +33,24 @@ module DiscourseCli
|
|
26
33
|
results = {}
|
27
34
|
while count == 30 do
|
28
35
|
topics = client.category_latest_topics(category_slug: category_slug, page: page)
|
29
|
-
|
30
|
-
|
31
|
-
|
36
|
+
if !topics.include?("The requested URL or resource could not be found.")
|
37
|
+
count = topics.count
|
38
|
+
if count > 0
|
39
|
+
topics.each do |t|
|
40
|
+
results[t['id']] = t
|
41
|
+
end
|
42
|
+
end
|
43
|
+
else
|
44
|
+
count = 0
|
32
45
|
end
|
33
46
|
page += 1
|
34
47
|
end
|
35
|
-
|
36
|
-
|
48
|
+
|
49
|
+
if count == 0
|
50
|
+
puts topics
|
51
|
+
else
|
52
|
+
puts "The following #{results.count} topics were found in the #{category_slug} category:"
|
53
|
+
end
|
37
54
|
puts
|
38
55
|
|
39
56
|
results.each do |k, v|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Blake Erickson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -90,9 +90,9 @@ description: ''
|
|
90
90
|
email:
|
91
91
|
- o.blakeerickson@gmail.com
|
92
92
|
executables:
|
93
|
-
- setup
|
94
|
-
- discourse
|
95
93
|
- console
|
94
|
+
- discourse
|
95
|
+
- setup
|
96
96
|
extensions: []
|
97
97
|
extra_rdoc_files: []
|
98
98
|
files:
|
@@ -108,6 +108,7 @@ files:
|
|
108
108
|
- bin/console
|
109
109
|
- bin/discourse
|
110
110
|
- bin/setup
|
111
|
+
- discourse_cli-0.3.0.gem
|
111
112
|
- discourse_cli.gemspec
|
112
113
|
- lib/discourse_cli.rb
|
113
114
|
- lib/discourse_cli/cli.rb
|
@@ -134,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
135
|
version: '0'
|
135
136
|
requirements: []
|
136
137
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.5.
|
138
|
+
rubygems_version: 2.4.5.1
|
138
139
|
signing_key:
|
139
140
|
specification_version: 4
|
140
141
|
summary: A command-line power tool for Discourse.
|