Open timuckun opened 2 years ago
+1
Is anybody even looking at these tickets?
Renaming the file to Thorfile
and removing the calls to start
does show the namespace when running thor list
require 'thor'
require 'dotenv'
Dotenv.load
module Db
class Ops < Thor
namespace :db
def self.exit_on_failure?
true
end
desc 'dump', 'dumps the database using pgdump'
def backup
puts 'Backup'
end
desc 'restore', 'loads the database from pgdump'
def restore
puts 'restore'
end
end
end
module Docker
class Commands < Thor
namespace :docker
desc 'start', 'starts docker compose'
def start; end
end
end
Outputs:
db
--
thor db:dump # dumps the database using pgdump
thor db:restore # loads the database from pgdump
docker
------
thor docker:start # starts docker compose
I'm not sure what the expected behaviour is for the original example file. Is this something Thor should support?
Hmm, this also how the https://github.com/rails/thor/blob/5fb6206a6d2d7bfb40bcb851c2e118ba39f69757/spec/fixtures/help.thor is implemented so I guess this is a bug.
See the following gist https://gist.github.com/timuckun/4b1e8f860cd47e0dc27423cad9563f4d
Calling this file results in this output (notice the lack of namespaces)