Commit bab4dee9 authored by Laurent Briais's avatar Laurent Briais

minor

parent 171a6094
Pipeline #114182661 passed with stage
in 1 minute and 9 seconds
......@@ -72,14 +72,14 @@ So `PowerStencil` is definitely not a templating engine, it is actually much mor
# Installation
You need a working install of the [Ruby] language (>= 2.3).
You need a working install of the [Ruby] language (>= 2.3). You should have `bundler` installed (`gem install bundler`). This is not added as an automatic dependency as updating `bundler` may not be what you want. Yet any working install of Ruby should consider having `bundler` installed.
:hand: It is **strongly** advised to have `git` installed on your system, as `PowerStencil` is integrated with `git` to provide a better user experience.
Then you can install the `PowerStencil` gem by issuing the usual:
$ gem install power_stencil
:hand: It is **strongly** advised to have `git` installed on your system, as `PowerStencil` is integrated with `git` to provide a better user experience.
If you want to create [Graphviz] graphs, you probably may want to install it for your system. If you are using an _apt-based_ system like Ubuntu or Debian it may probably be as simple as:
$ sudo apt install graphviz
......@@ -205,7 +205,7 @@ It provides a very useful auto-completion for sub-commands, options as well as o
* Project independent completion is generated in `~/.zsh/completion/_power_stencil`, whereas completion related to new commands or options, coming from plugins used in a project, is generated (and versioned) within the project itself, in `.ps_project/.zsh_project_completion`.
* Meaning that if you want to benefit from the "_full_" completion from within a project you may have to re-run `power_stencil add --zsh-completion` from within any project where you use extra plugins, in order to generate that `.ps_project/.zsh_project_completion` file. If you don't, it is not a big deal, but then you will only have access to the "_generic_" completion, ie completion not taking in account any of the extra commands or options you are using in this project brought by plugins you may use...
* Meaning that if you want to benefit from the "_full_" completion from within a project (ie including extra command line options brought by the project itself), you may have to re-run `power_stencil add --zsh-completion` from within any project where you use extra plugins, in order to (re)generate the `.ps_project/.zsh_project_completion` file. If you don't, it is not a big deal, but then you will only have access to the "_generic_" completion, ie completion not taking in account any of the extra commands or options you are using in this project brought by plugins you may use...
### Entities
......
......@@ -12,6 +12,7 @@ Plugins
- [Creating plugin local to the project](#creating-plugin-local-to-the-project)
- [Plugin creation](#plugin-creation)
- [Adding new subcommands to `PowerStencil`](#adding-new-subcommands-to-powerstencil)
- [Updating zsh auto-completion](#updating-zsh-auto-completion)
- [Providing entity types and templates](#providing-entity-types-and-templates)
- [Providing custom build process](#providing-custom-build-process)
- [Plugin capabilities and structure](#plugin-capabilities-and-structure)
......@@ -183,6 +184,15 @@ MYPLUGIN PLUGIN WAZ HERE !!
Wow it worked ! Useless, but worked ! But it's a good demo on how to create your own subcommands in `PowerStencil`.
## Updating zsh auto-completion
When you add a plugin to a project, be it local or from a separated gem, you may want to update the command-line auto-completion for that project as new plugins may add extra command-line options and sub-commands.
You do that as you probably already [dit it initially][completion].
$ power_stencil adm --zsh-completion
## Providing entity types and templates
Of course you can provide new entity types and templates templates within plugin. The plugin created contains a demo entity type which brings its own template template (and even a custom build, but we will see that in next paragraph).
......@@ -507,6 +517,7 @@ The documentation for plugins is not fully complete, so you are encouraged to re
[builds]: builds.md "Builds in PowerStencil"
[templates]: templates.md "Templates in PowerStencil"
[post-process]: builds.md#post-process-actions "post-process actions in builds"
[completion]: ../README.md#command-line-auto-completion "how to setup zsh command-line auto-completion"
<!-- Code links -->
......
......@@ -127,7 +127,7 @@ module PowerStencil
target_plugin = project.plugins[target_plugin_name]
raise PowerStencil::Error, "Could not find plugin '#{target_plugin_name}' !" if target_plugin.nil?
if target_plugin.capabilities[:generate_build_files]
target_plugin.generate_build_files entity_to_build, target_path
target_plugin.generate_build_files entity_to_build, target_path, &:generate_build_files
else
logger.info 'Falling back to PowerStencil core build files generation process...'
generate_build_files entity_to_build, target_path
......
......@@ -24,7 +24,6 @@ class UltraCommandLine::Manager::Base
end
end
# private
def internal_provider_mapping
@internal_provider_mapping ||= {}
......@@ -32,4 +31,22 @@ class UltraCommandLine::Manager::Base
end
# def contribute_to_definition(hash, layer_name: :unknown_layer)
# super
# end
def processor
processor_candidates = processors_hash.fetch(command(cmd_line_args).name, []) .select do |processor|
processor.check_params command.cmd_line_args
end
raise UltraCommandLine::Error, 'No processor found for this command line' if processor_candidates.empty?
return processor_candidates.first if processor_candidates.size == 1
raise UltraCommandLine::Error, 'Too many possible processors' unless processor_candidates.size == 1
processor_candidates.first
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment