Class: Rbnotes::Commands::Builtins::Repo

Inherits:
Command
  • Object
show all
Defined in:
lib/rbnotes/commands.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



113
114
115
# File 'lib/rbnotes/commands.rb', line 113

def description
  "Print repository path"
end

#execute(_, conf) ⇒ Object



117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/rbnotes/commands.rb', line 117

def execute(_, conf)
  name = conf[:repository_name]
  base = conf[:repository_base]
  type = conf[:repository_type]

  puts case type
       when :file_system
         File.expand_path(name, base)
       else
         File.join(base, name)
       end
end

#helpObject



130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/rbnotes/commands.rb', line 130

def help
  puts <<REPO
usage:
    #{Rbnotes::NAME} repo

Print the path of the repository.  The type of the path entity depends
on what type is specified to the repository type in the configuration.
When ":file_system" is set to "repository_type", the path is a
directory which contains all note files.  The structure of the
directory depends on the implementation of `textrepo`.
REPO
end