Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github-pages & update landing page docs #46

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
.mypy_cache
.poetry.ready
.pytest_cache
docs/.buildinfo
docs/.doctrees
python/build
python/dazl.egg-info
python/dist
Expand Down
80 changes: 0 additions & 80 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
Empty file added docs/.nojekyll
Empty file.
181 changes: 181 additions & 0 deletions docs/_modules/dazl/cli.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
<!DOCTYPE html>
<html lang="" >
<head>
<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>dazl.cli</title>


<link rel="apple-touch-icon" sizes="180x180" href="../../_static/apple-touch-icon.png"/>
<link rel="icon" type="image/png" href="../../_static/favicon-32x32.png" sizes="32x32"/>
<link rel="icon" type="image/png" href="../../_static/favicon-16x16.png" sizes="16x16"/>
<link rel="shortcut icon" href="../../_static/favicon.ico"/>













<link rel="stylesheet" href="../../_static/css/theme.css" type="text/css" />





<link rel="index" title="Index"
href="../../genindex.html"/>
<link rel="search" title="Search" href="../../search.html"/>
<link rel="top" title="dazl unknown documentation" href="../../index.html"/>
<link rel="up" title="Module code" href="../index.html"/>
</head>
<body>



<header>
dazl

</header>
<nav>





<p class="caption"><span class="caption-text">Contents:</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../basics.html">Basics</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../migrating.html">Migrate</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../tutorials.html">Tutorials</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dazl.html">dazl package</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary.html">Glossary</a></li>
</ul>



</nav>
<main>

<h1>Source code for dazl.cli</h1><div class="highlight"><pre>
<span></span><span class="c1"># Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.</span>
<span class="c1"># SPDX-License-Identifier: Apache-2.0</span>

<span class="sd">&quot;&quot;&quot;</span>
<span class="sd">Simple command-line handlers.</span>
<span class="sd">&quot;&quot;&quot;</span>

<span class="kn">import</span> <span class="nn">logging</span>
<span class="kn">import</span> <span class="nn">sys</span>
<span class="kn">from</span> <span class="nn">typing</span> <span class="k">import</span> <span class="n">List</span><span class="p">,</span> <span class="n">Sequence</span>

<span class="kn">from</span> <span class="nn">..</span> <span class="k">import</span> <span class="n">setup_default_logger</span>
<span class="kn">from</span> <span class="nn">..model.core</span> <span class="k">import</span> <span class="n">ConfigurationError</span>
<span class="kn">from</span> <span class="nn">._base</span> <span class="k">import</span> <span class="n">CliCommand</span>
<span class="kn">from</span> <span class="nn">.fetch</span> <span class="k">import</span> <span class="n">FetchComponentCommand</span>
<span class="kn">from</span> <span class="nn">.ls</span> <span class="k">import</span> <span class="n">ListAllCommand</span>
<span class="kn">from</span> <span class="nn">.metadata</span> <span class="k">import</span> <span class="n">PrintMetadataCommand</span>
<span class="kn">from</span> <span class="nn">.package</span> <span class="k">import</span> <span class="n">PackageDarCommand</span>
<span class="kn">from</span> <span class="nn">.sandbox</span> <span class="k">import</span> <span class="n">SandboxCommand</span>
<span class="kn">from</span> <span class="nn">.tail</span> <span class="k">import</span> <span class="n">TailCommand</span>
<span class="kn">from</span> <span class="nn">.upload</span> <span class="k">import</span> <span class="n">UploadCommand</span>
<span class="kn">from</span> <span class="nn">.version</span> <span class="k">import</span> <span class="n">VersionCommand</span>

<span class="n">COMMANDS</span> <span class="o">=</span> <span class="p">[</span>
<span class="n">FetchComponentCommand</span><span class="p">(),</span>
<span class="n">ListAllCommand</span><span class="p">(),</span>
<span class="n">PrintMetadataCommand</span><span class="p">(),</span>
<span class="n">PackageDarCommand</span><span class="p">(),</span>
<span class="n">SandboxCommand</span><span class="p">(),</span>
<span class="n">TailCommand</span><span class="p">(),</span>
<span class="n">UploadCommand</span><span class="p">(),</span>
<span class="n">VersionCommand</span><span class="p">(),</span>
<span class="p">]</span> <span class="c1"># type: List[CliCommand]</span>


<div class="viewcode-block" id="main"><a class="viewcode-back" href="../../dazl.cli.html#dazl.cli.main">[docs]</a><span class="k">def</span> <span class="nf">main</span><span class="p">():</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="sd"> Executes one of the known commands.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="kn">from</span> <span class="nn">sys</span> <span class="k">import</span> <span class="n">argv</span><span class="p">,</span> <span class="n">exit</span>
<span class="n">exit</span><span class="p">(</span><span class="n">_main</span><span class="p">(</span><span class="n">argv</span><span class="p">))</span></div>


<span class="k">def</span> <span class="nf">_main</span><span class="p">(</span><span class="n">argv</span><span class="p">:</span> <span class="s1">&#39;Sequence[str]&#39;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">argv</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">:</span>
<span class="n">command</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span>
<span class="n">command_args</span> <span class="o">=</span> <span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">:]</span>

<span class="k">for</span> <span class="n">cmd</span> <span class="ow">in</span> <span class="n">COMMANDS</span><span class="p">:</span>
<span class="k">if</span> <span class="n">cmd</span><span class="o">.</span><span class="n">name</span> <span class="o">==</span> <span class="n">command</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
<span class="k">return</span> <span class="n">run</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">command_args</span><span class="p">)</span>
<span class="k">except</span> <span class="n">ConfigurationError</span> <span class="k">as</span> <span class="n">error</span><span class="p">:</span>
<span class="k">for</span> <span class="n">reason</span> <span class="ow">in</span> <span class="n">error</span><span class="o">.</span><span class="n">reasons</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">reason</span><span class="p">)</span>
<span class="k">return</span> <span class="o">-</span><span class="mi">1</span>

<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Unknown command: &quot;</span> <span class="o">+</span> <span class="n">command</span><span class="p">)</span>

<span class="n">print_cmd_help</span><span class="p">()</span>
<span class="k">return</span> <span class="o">-</span><span class="mi">2</span>


<div class="viewcode-block" id="run"><a class="viewcode-back" href="../../dazl.cli.html#dazl.cli.run">[docs]</a><span class="k">def</span> <span class="nf">run</span><span class="p">(</span><span class="n">cmd</span><span class="p">,</span> <span class="n">args</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
<span class="n">parser</span> <span class="o">=</span> <span class="n">cmd</span><span class="o">.</span><span class="n">parser</span><span class="p">()</span>
<span class="n">parsed_args</span> <span class="o">=</span> <span class="n">parser</span><span class="o">.</span><span class="n">parse_args</span><span class="p">(</span><span class="n">args</span><span class="p">)</span>

<span class="n">log_level</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">parsed_args</span><span class="p">,</span> <span class="s1">&#39;log_level&#39;</span><span class="p">,</span> <span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span><span class="p">)</span>
<span class="k">if</span> <span class="n">log_level</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">log_level</span> <span class="o">=</span> <span class="n">logging</span><span class="o">.</span><span class="n">WARNING</span>

<span class="n">setup_default_logger</span><span class="p">(</span><span class="n">level</span><span class="o">=</span><span class="n">log_level</span><span class="p">)</span>
<span class="k">return</span> <span class="n">cmd</span><span class="o">.</span><span class="n">execute</span><span class="p">(</span><span class="n">parsed_args</span><span class="p">)</span></div>


<div class="viewcode-block" id="print_cmd_help"><a class="viewcode-back" href="../../dazl.cli.html#dazl.cli.print_cmd_help">[docs]</a><span class="k">def</span> <span class="nf">print_cmd_help</span><span class="p">():</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;Valid commands:&quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">cmd</span> <span class="ow">in</span> <span class="n">COMMANDS</span><span class="p">:</span>
<span class="k">if</span> <span class="ow">not</span> <span class="n">cmd</span><span class="o">.</span><span class="n">hidden</span><span class="p">:</span>
<span class="nb">print</span><span class="p">(</span><span class="n">cmd</span><span class="o">.</span><span class="n">name</span><span class="p">)</span></div>
</pre></div>

</main>



<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT:'',
VERSION:'unknown',
LANGUAGE:'None',
COLLAPSE_INDEX:false,
FILE_SUFFIX:'.html',
HAS_SOURCE: true,
SOURCELINK_SUFFIX: '.txt'
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/language_data.js"></script>





<script type="text/javascript" src="../../_static/js/theme.js"></script>


<footer>
</footer>
</body>
</html>
Loading