discourse-disco-cli 0.3.0 → 0.3.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.
- checksums.yaml +4 -4
- data/lib/discourse_disco/cli/bootstrap.rb +14 -1
- data/lib/discourse_disco/cli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8764e0f164f46d534f4a83eeb0cc67cce8fdd6d0b4559dd586a561aa5a404274
|
|
4
|
+
data.tar.gz: b08d4f60f58177fcb6cc6365ccd1f686b3b5ef3163cea382797595ebb2d75d01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 397f3f681ee2da6da71e342d7a4d6178c8b684bde8cb55d3b39c89b65e46d1ee4f5487f17ec0e3c040377e8bccbba5dab78c64e0e1269b87371abfe631fab47a
|
|
7
|
+
data.tar.gz: 0ef3e17ae57cb34d171ccf6a126c210bb2b437e459c29ed18e9c39330de03384450fc17ff2aec0b57b16b9c47effe3241e8348446c3e1a69e933c6ae40d7e662
|
|
@@ -27,7 +27,8 @@ module DiscourseDisco
|
|
|
27
27
|
top = build_top_command_class(description, selected&.name).new(argv, name: program_name)
|
|
28
28
|
|
|
29
29
|
leaf = deepest_command(top)
|
|
30
|
-
if leaf.class.respond_to?(:requires_rails?) && leaf.class.requires_rails?
|
|
30
|
+
if leaf.class.respond_to?(:requires_rails?) && leaf.class.requires_rails? &&
|
|
31
|
+
!help_requested?(leaf)
|
|
31
32
|
CLI.boot_rails!(command_line(leaf))
|
|
32
33
|
end
|
|
33
34
|
|
|
@@ -62,6 +63,18 @@ module DiscourseDisco
|
|
|
62
63
|
end
|
|
63
64
|
end
|
|
64
65
|
|
|
66
|
+
# A command prints its usage for `--help` without using Rails, so booting
|
|
67
|
+
# Rails for it would only be slow, and without a Discourse install it
|
|
68
|
+
# would fail instead of showing the help.
|
|
69
|
+
def self.help_requested?(command)
|
|
70
|
+
node = command
|
|
71
|
+
while node
|
|
72
|
+
return true if node.respond_to?(:options) && node.options&.dig(:help)
|
|
73
|
+
node = node.parent
|
|
74
|
+
end
|
|
75
|
+
false
|
|
76
|
+
end
|
|
77
|
+
|
|
65
78
|
# Walks the nested `command` chain to the deepest selected sub-command.
|
|
66
79
|
def self.deepest_command(command)
|
|
67
80
|
node = command
|