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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff6af9157046dd4c925075c0bbc104743a31a68e608226611a1c0dc612d63142
4
- data.tar.gz: a6e859510df7fac5aa1b8588e0ea5d0b983b865d4109a57034ca116330c37ec1
3
+ metadata.gz: 8764e0f164f46d534f4a83eeb0cc67cce8fdd6d0b4559dd586a561aa5a404274
4
+ data.tar.gz: b08d4f60f58177fcb6cc6365ccd1f686b3b5ef3163cea382797595ebb2d75d01
5
5
  SHA512:
6
- metadata.gz: dfe3cbca1bcb2f7aa8fe6d61e17adaa760a5d9487d9a8fb04109abee0a5fb9925b53e4fdc6442741bb4f3c415e14bbcb7f7cec3f7ca7498d6430ffbccbe0c07f
7
- data.tar.gz: ed02ef6b32c85ea8428aa300d84d6f541c7de83807c23928a3252f9781ff3d234703300cda09b83ef1c0f8f69dedc55c16ee739109599239c3dffc1cd4543b0b
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module DiscourseDisco
4
4
  module CLI
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discourse-disco-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Discourse Team