{
    "componentChunkName": "component---src-templates-doc-tsx",
    "path": "/docs/3.9.x/en/development/cli-guideline/",
    "result": {"data":{"navigation":{"nodes":[{"section":"Getting started","entries":[{"frontmatter":{"title":"Installation","subtitle":"Installation of scm-manager","partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/installation/"}},{"frontmatter":{"title":"First Startup","subtitle":"Administration User Creation","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/first-startup/"}},{"frontmatter":{"title":"Migrate from v1 to v3","subtitle":"How to use the Migration-Wizard","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/migrate-scm-manager-from-v1/"}},{"frontmatter":{"title":"Migrate from v2 to v3","subtitle":"Changes in the configuration","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/migrate-scm-manager-from-v2/"}},{"frontmatter":{"title":"Import existing repositories","subtitle":"How to import existing repositories into SCM-Manager","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/import/"}},{"frontmatter":{"title":"Frequently Asked Questions","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/faq/"}},{"frontmatter":{"title":"Known Issues","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/known-issues/"}}]},{"section":"User-oriented","entries":[{"frontmatter":{"title":"Repository","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/repo/"}},{"frontmatter":{"title":"User","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/user/"}},{"frontmatter":{"title":"Groups","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/group/"}},{"frontmatter":{"title":"Administration","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/admin/"}},{"frontmatter":{"title":"Profile","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/profile/"}},{"frontmatter":{"title":"Notifications","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/notification/"}},{"frontmatter":{"title":"CLI Client","subtitle":null,"partiallyActive":true},"fields":{"slug":"/docs/3.9.x/en/user/cli/"}},{"frontmatter":{"title":"Shortcuts","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/user/shortcuts/"}}]},{"section":"Administration","entries":[{"frontmatter":{"title":"Base Directory","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/administration/basedirectory/"}},{"frontmatter":{"title":"Logging","subtitle":"Configuration and locations of SCM-Manager logging","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/administration/logging/"}},{"frontmatter":{"title":"SCM-Server Configuration","subtitle":"Various configuration options for the SCM-Server","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/administration/scm-server/"}},{"frontmatter":{"title":"Reverse Proxy","subtitle":"How to use SCM-Manager with common reverse proxies","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/administration/reverse-proxies/"}},{"frontmatter":{"title":"Caching for Working Directories","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/administration/workdir_caching/"}}]},{"section":"Development","entries":[{"frontmatter":{"title":"Intellij IDEA Configuration","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/intellij-idea-configuration/"}},{"frontmatter":{"title":"Building SCM-Manager from Source","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/build-from-source/"}},{"frontmatter":{"title":"Architecture overview","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/architecture-overview/"}},{"frontmatter":{"title":"Common pitfall occurred while developing the SCM V2","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/ui-common-pitfall/"}},{"frontmatter":{"title":"Permission Concept","subtitle":"Fine-grained permission for SCM-Manager v2","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/permission-concept/"}},{"frontmatter":{"title":"Decision Table","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/decision-table/"}},{"frontmatter":{"title":"Error Handling","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/error-handling/"}},{"frontmatter":{"title":"Styleguide","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/styleguide/"}},{"frontmatter":{"title":"Testing Guide","subtitle":"Howto write tests for SCM-Manager","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/testing-guide/"}},{"frontmatter":{"title":"Integration Tests","subtitle":"How to run integration tests","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/integration-tests/"}},{"frontmatter":{"title":"UI-Extensions","subtitle":"How to extend the SCM-Manager UI with plugins","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/ui-extensions/"}},{"frontmatter":{"title":"I18n","subtitle":"Howto do internationalization","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/i18n/"}},{"frontmatter":{"title":"Building Forms","subtitle":"Howto build forms for SCM-Manager","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/building-forms/"}},{"frontmatter":{"title":"Javadoc","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/javadoc/"}},{"frontmatter":{"title":"CLI Guidelines","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/cli-guideline/"}},{"frontmatter":{"title":"Definition of Done","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/definition-of-done/"}},{"frontmatter":{"title":"DOD for UI development","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/ui-dod/"}}]},{"section":"Plugin Development","entries":[{"frontmatter":{"title":"Create a plugin","subtitle":"Create a new SCM-Manager plugin","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/create/"}},{"frontmatter":{"title":"Migrate a v1 plugin","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/migrate-plugin-from-v1/"}},{"frontmatter":{"title":"Extension Points","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/extension-points/"}},{"frontmatter":{"title":"i18n for Plugins","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/i18n-for-plugins/"}},{"frontmatter":{"title":"Plugin Descriptor","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/plugin-descriptor/"}},{"frontmatter":{"title":"SCM-Manager v2 Plugin Development","subtitle":null,"partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/plugin-development/"}},{"frontmatter":{"title":"Publish","subtitle":"Publish your Plugin","partiallyActive":null},"fields":{"slug":"/docs/3.9.x/en/development/plugins/publish/"}}]}]},"versions":{"group":[{"fieldValue":"1.0.x"},{"fieldValue":"1.x"},{"fieldValue":"2.0.x"},{"fieldValue":"2.1.x"},{"fieldValue":"2.10.x"},{"fieldValue":"2.11.x"},{"fieldValue":"2.12.x"},{"fieldValue":"2.13.x"},{"fieldValue":"2.14.x"},{"fieldValue":"2.15.x"},{"fieldValue":"2.16.x"},{"fieldValue":"2.17.x"},{"fieldValue":"2.18.x"},{"fieldValue":"2.19.x"},{"fieldValue":"2.2.x"},{"fieldValue":"2.20.x"},{"fieldValue":"2.21.x"},{"fieldValue":"2.22.x"},{"fieldValue":"2.23.x"},{"fieldValue":"2.24.x"},{"fieldValue":"2.25.x"},{"fieldValue":"2.26.x"},{"fieldValue":"2.27.x"},{"fieldValue":"2.28.x"},{"fieldValue":"2.29.x"},{"fieldValue":"2.3.x"},{"fieldValue":"2.30.x"},{"fieldValue":"2.31.x"},{"fieldValue":"2.32.x"},{"fieldValue":"2.33.x"},{"fieldValue":"2.34.x"},{"fieldValue":"2.35.x"},{"fieldValue":"2.36.x"},{"fieldValue":"2.37.x"},{"fieldValue":"2.38.x"},{"fieldValue":"2.39.x"},{"fieldValue":"2.4.x"},{"fieldValue":"2.40.x"},{"fieldValue":"2.41.x"},{"fieldValue":"2.42.x"},{"fieldValue":"2.43.x"},{"fieldValue":"2.44.x"},{"fieldValue":"2.45.x"},{"fieldValue":"2.46.x"},{"fieldValue":"2.47.x"},{"fieldValue":"2.48.x"},{"fieldValue":"2.5.x"},{"fieldValue":"2.6.x"},{"fieldValue":"2.7.x"},{"fieldValue":"2.8.x"},{"fieldValue":"2.9.x"},{"fieldValue":"3.0.x"},{"fieldValue":"3.1.x"},{"fieldValue":"3.10.x"},{"fieldValue":"3.11.x"},{"fieldValue":"3.2.x"},{"fieldValue":"3.3.x"},{"fieldValue":"3.4.x"},{"fieldValue":"3.5.x"},{"fieldValue":"3.6.x"},{"fieldValue":"3.7.x"},{"fieldValue":"3.8.x"},{"fieldValue":"3.9.x"}]},"languages":{"group":[{"fieldValue":"de"},{"fieldValue":"en"}]},"markdownRemark":{"html":"<h2 id=\"resource-centered-api\" style=\"position:relative;\"><a href=\"#resource-centered-api\" aria-label=\"resource centered api permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Resource centered api</h2>\n<p>Every new command group starts with the resource name like <code class=\"language-text\">repo</code>.\nCommands should be defined as singular. For repository commands it is <code class=\"language-text\">repo</code> and <strong>not</strong> <code class=\"language-text\">repos</code>.\nYou may set aliases to make your command more convenient to use.</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@CommandLine.Command</span><span class=\"token punctuation\">(</span>name <span class=\"token operator\">=</span> <span class=\"token string\">\"repo\"</span><span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"subcommands\" style=\"position:relative;\"><a href=\"#subcommands\" aria-label=\"subcommands permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Subcommands</h2>\n<p>Subcommands are action centered and can look like <code class=\"language-text\">scm repo create x/y</code>.</p>\n<p>The RepositoryCreateCommand is a subcommand of RepositoryCommand and must be explicitly annotated.</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\"><span class=\"token annotation punctuation\">@ParentCommand</span><span class=\"token punctuation\">(</span>value <span class=\"token operator\">=</span> <span class=\"token class-name\">RepositoryCommand</span><span class=\"token punctuation\">.</span><span class=\"token keyword\">class</span><span class=\"token punctuation\">)</span></code></pre></div>\n<h2 id=\"parameters-and-options\" style=\"position:relative;\"><a href=\"#parameters-and-options\" aria-label=\"parameters and options permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Parameters and options</h2>\n<p>Every required field for a command must be a parameter. All other fields have to be options.</p>\n<p><code class=\"language-text\">scm repo create git namespace/name --init --description=\"test\"</code></p>\n<p>The repository <code class=\"language-text\">type</code> and <code class=\"language-text\">namespace/name</code> must be set, so they must be annotated as parameters.\nThe other fields like <code class=\"language-text\">init</code> and <code class=\"language-text\">description</code> are optional and are therefore annotated as options.</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">  <span class=\"token annotation punctuation\">@CommandLine.Parameters</span>\n  <span class=\"token keyword\">private</span> <span class=\"token class-name\">String</span> type<span class=\"token punctuation\">;</span>\n  <span class=\"token annotation punctuation\">@CommandLine.Parameters</span>\n  <span class=\"token keyword\">private</span> <span class=\"token class-name\">String</span> repository<span class=\"token punctuation\">;</span>\n  <span class=\"token annotation punctuation\">@CommandLine.Option</span><span class=\"token punctuation\">(</span>names <span class=\"token operator\">=</span> <span class=\"token string\">\"--description\"</span><span class=\"token punctuation\">)</span>\n  <span class=\"token keyword\">private</span> <span class=\"token class-name\">String</span> description<span class=\"token punctuation\">;</span>\n  <span class=\"token annotation punctuation\">@CommandLine.Option</span><span class=\"token punctuation\">(</span>names <span class=\"token operator\">=</span> <span class=\"token string\">\"--contact\"</span><span class=\"token punctuation\">)</span>\n  <span class=\"token keyword\">private</span> <span class=\"token class-name\">String</span> contact<span class=\"token punctuation\">;</span>\n  <span class=\"token annotation punctuation\">@CommandLine.Option</span><span class=\"token punctuation\">(</span>names <span class=\"token operator\">=</span> <span class=\"token string\">\"--init\"</span><span class=\"token punctuation\">)</span>\n  <span class=\"token keyword\">private</span> <span class=\"token keyword\">boolean</span> init<span class=\"token punctuation\">;</span></code></pre></div>\n<h2 id=\"templating\" style=\"position:relative;\"><a href=\"#templating\" aria-label=\"templating permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Templating</h2>\n<p>Commands which return large texts or much content should allow templating.\nThis can be achieved by using the TemplateRenderer.\nIf you inject the TemplateRenderer you must annotate it as a Mixin:</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">  <span class=\"token annotation punctuation\">@CommandLine.Mixin</span>\n  <span class=\"token keyword\">private</span> <span class=\"token keyword\">final</span> <span class=\"token class-name\">TemplateRenderer</span> templateRenderer<span class=\"token punctuation\">;</span></code></pre></div>\n<h3 id=\"table\" style=\"position:relative;\"><a href=\"#table\" aria-label=\"table permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Table</h3>\n<p>Besides \"loose\" templates, you can use a table-like template to render your output.\nFor this purpose use the TemplateRender and create table first.\nThen add your table headers and rows.</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">      <span class=\"token class-name\">Table</span> table <span class=\"token operator\">=</span> templateRenderer<span class=\"token punctuation\">.</span><span class=\"token function\">createTable</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      table<span class=\"token punctuation\">.</span><span class=\"token function\">addHeader</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoName\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"repoType\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"repoUrl\"</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token keyword\">for</span> <span class=\"token punctuation\">(</span><span class=\"token class-name\">RepositoryCommandDto</span> dto <span class=\"token operator\">:</span> dtos<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n        table<span class=\"token punctuation\">.</span><span class=\"token function\">addRow</span><span class=\"token punctuation\">(</span>dto<span class=\"token punctuation\">.</span><span class=\"token function\">getNamespace</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token operator\">+</span> <span class=\"token string\">\"/\"</span> <span class=\"token operator\">+</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getName</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getType</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getUrl</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n      <span class=\"token punctuation\">}</span>\n      templateRenderer<span class=\"token punctuation\">.</span><span class=\"token function\">renderToStdout</span><span class=\"token punctuation\">(</span><span class=\"token constant\">TABLE_TEMPLATE</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">ImmutableMap</span><span class=\"token punctuation\">.</span><span class=\"token function\">of</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"rows\"</span><span class=\"token punctuation\">,</span> table<span class=\"token punctuation\">,</span> <span class=\"token string\">\"repos\"</span><span class=\"token punctuation\">,</span> dtos<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h4 id=\"result\" style=\"position:relative;\"><a href=\"#result\" aria-label=\"result permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Result</h4>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre class=\"language-shell\"><code class=\"language-shell\">    NAME                   TYPE URL \n    scmadmin/nice_repo     <span class=\"token function\">git</span>  http://localhost:8081/scm/repo/scmadmin/nice_repo    </code></pre></div>\n<h3 id=\"keyvalue-table\" style=\"position:relative;\"><a href=\"#keyvalue-table\" aria-label=\"keyvalue table permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Key/Value Table</h3>\n<p>To create a two column (key-value-style) table you can use the <code class=\"language-text\">addKeyValueRow()</code> method.</p>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">    <span class=\"token class-name\">Table</span> table <span class=\"token operator\">=</span> <span class=\"token function\">createTable</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token class-name\">RepositoryCommandDto</span> dto <span class=\"token operator\">=</span> mapper<span class=\"token punctuation\">.</span><span class=\"token function\">map</span><span class=\"token punctuation\">(</span>repository<span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    table<span class=\"token punctuation\">.</span><span class=\"token function\">addLabelValueRow</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoNamespace\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getNamespace</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    table<span class=\"token punctuation\">.</span><span class=\"token function\">addLabelValueRow</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoName\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getName</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    table<span class=\"token punctuation\">.</span><span class=\"token function\">addLabelValueRow</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoType\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getType</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    table<span class=\"token punctuation\">.</span><span class=\"token function\">addLabelValueRow</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoContact\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getContact</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    table<span class=\"token punctuation\">.</span><span class=\"token function\">addLabelValueRow</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoUrl\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getUrl</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    table<span class=\"token punctuation\">.</span><span class=\"token function\">addLabelValueRow</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"repoDescription\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">.</span><span class=\"token function\">getDescription</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n    <span class=\"token function\">renderToStdout</span><span class=\"token punctuation\">(</span><span class=\"token constant\">DETAILS_TABLE_TEMPLATE</span><span class=\"token punctuation\">,</span> <span class=\"token class-name\">ImmutableMap</span><span class=\"token punctuation\">.</span><span class=\"token function\">of</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"rows\"</span><span class=\"token punctuation\">,</span> table<span class=\"token punctuation\">,</span> <span class=\"token string\">\"repo\"</span><span class=\"token punctuation\">,</span> dto<span class=\"token punctuation\">)</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<h4 id=\"result-1\" style=\"position:relative;\"><a href=\"#result-1\" aria-label=\"result 1 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Result</h4>\n<div class=\"gatsby-highlight\" data-language=\"shell\"><pre class=\"language-shell\"><code class=\"language-shell\">Namespace: scmadmin                                        \nName     <span class=\"token builtin class-name\">:</span> testrepo                                        \nType     <span class=\"token builtin class-name\">:</span> <span class=\"token function\">git</span>     </code></pre></div>\n<h2 id=\"i18n\" style=\"position:relative;\"><a href=\"#i18n\" aria-label=\"i18n permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>I18n</h2>\n<p>The CLI client commands should support multiple languages.\nThis can be done by using translation keys in the related resource bundles.\nBy default, we support English and German translations.</p>\n<h3 id=\"example\" style=\"position:relative;\"><a href=\"#example\" aria-label=\"example permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Example</h3>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">  <span class=\"token keyword\">static</span> <span class=\"token keyword\">final</span> <span class=\"token class-name\">String</span> <span class=\"token constant\">DEFAULT_TEMPLATE</span> <span class=\"token operator\">=</span> <span class=\"token class-name\">String</span><span class=\"token punctuation\">.</span><span class=\"token function\">join</span><span class=\"token punctuation\">(</span><span class=\"token string\">\"\\n\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"{{repo.namespace}}/{{repo.name}}\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"{{i18n.repoDescription}}: {{repo.description}}\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"{{i18n.repoType}}: {{repo.type}}\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token string\">\"{{i18n.repoContact}}: {{repo.contact}}\"</span>\n  <span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span></code></pre></div>\n<p>The variables starting with <code class=\"language-text\">i18n</code> are translations from the resource bundles.\nThe fields starting with <code class=\"language-text\">repo</code> are context related model data from the repository we are currently accessing.</p>\n<h2 id=\"error-handling\" style=\"position:relative;\"><a href=\"#error-handling\" aria-label=\"error handling permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Error handling</h2>\n<p>There are different options on how to handle errors.\nYou can use the TemplateRender and print the errors or exception messages to stderr channel.</p>\n<p>However, you also can throw an exception directly inside your execution.\nThese exceptions will be handled by the CliExceptionHandler and will be printed to the stderr channel based on a specific template.</p>\n<h2 id=\"validation\" style=\"position:relative;\"><a href=\"#validation\" aria-label=\"validation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Validation</h2>\n<p>The CLI commands support Java bean validation.\nIf you want to use this validation you have to inject the CommandValidator and call <code class=\"language-text\">validator.validate()</code> in the first line of the command execution.\nThen you can simply annotate your fields with validation annotations.</p>\n<h3 id=\"example-1\" style=\"position:relative;\"><a href=\"#example-1\" aria-label=\"example 1 permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Example</h3>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">  <span class=\"token annotation punctuation\">@Email</span>\n  <span class=\"token annotation punctuation\">@CommandLine.Option</span><span class=\"token punctuation\">(</span>names <span class=\"token operator\">=</span> <span class=\"token punctuation\">{</span><span class=\"token string\">\"--contact\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"-c\"</span><span class=\"token punctuation\">}</span><span class=\"token punctuation\">)</span>\n  <span class=\"token keyword\">private</span> <span class=\"token class-name\">String</span> contact<span class=\"token punctuation\">;</span></code></pre></div>\n<div class=\"gatsby-highlight\" data-language=\"java\"><pre class=\"language-java\"><code class=\"language-java\">  <span class=\"token annotation punctuation\">@Inject</span>\n  <span class=\"token keyword\">public</span> <span class=\"token class-name\">MyCommand</span><span class=\"token punctuation\">(</span><span class=\"token class-name\">CommandValidator</span> validator<span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token keyword\">this</span><span class=\"token punctuation\">.</span>validator <span class=\"token operator\">=</span> validator<span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">}</span>\n\n<span class=\"token annotation punctuation\">@Override</span>\n<span class=\"token keyword\">public</span> <span class=\"token keyword\">void</span> <span class=\"token function\">run</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span> <span class=\"token punctuation\">{</span>\n  validator<span class=\"token punctuation\">.</span><span class=\"token function\">validate</span><span class=\"token punctuation\">(</span><span class=\"token punctuation\">)</span><span class=\"token punctuation\">;</span>\n  <span class=\"token punctuation\">.</span><span class=\"token punctuation\">.</span><span class=\"token punctuation\">.</span>\n<span class=\"token punctuation\">}</span></code></pre></div>","description":"Resource centered api Every new command group starts with the resource name like .\nCommands should be defined as singular. For repository commands it is  and…","tableOfContents":"<ul>\n<li>\n<p><a href=\"#resource-centered-api\">Resource centered api</a></p>\n</li>\n<li>\n<p><a href=\"#subcommands\">Subcommands</a></p>\n</li>\n<li>\n<p><a href=\"#parameters-and-options\">Parameters and options</a></p>\n</li>\n<li>\n<p><a href=\"#templating\">Templating</a></p>\n<ul>\n<li>\n<p><a href=\"#table\">Table</a></p>\n<ul>\n<li><a href=\"#result\">Result</a></li>\n</ul>\n</li>\n<li>\n<p><a href=\"#keyvalue-table\">Key/Value Table</a></p>\n<ul>\n<li><a href=\"#result-1\">Result</a></li>\n</ul>\n</li>\n</ul>\n</li>\n<li>\n<p><a href=\"#i18n\">I18n</a></p>\n<ul>\n<li><a href=\"#example\">Example</a></li>\n</ul>\n</li>\n<li>\n<p><a href=\"#error-handling\">Error handling</a></p>\n</li>\n<li>\n<p><a href=\"#validation\">Validation</a></p>\n<ul>\n<li><a href=\"#example-1\">Example</a></li>\n</ul>\n</li>\n</ul>","frontmatter":{"title":"CLI Guidelines","subtitle":null,"displayToc":null,"description":null,"keywords":null,"image":null}}},"pageContext":{"slug":"/docs/3.9.x/en/development/cli-guideline/","version":"3.9.x","latestVersion":"3.11.x","latestPageVersion":"3.11.x","language":"en","relativePath":"/development/cli-guideline/","canonicalPath":"/docs/latest/en/development/cli-guideline/","latestRootPath":"/docs/3.11.x/en/"}},
    "staticQueryHashes": ["1973669194","2742214048","2956773653","2957019495","698804963"]}