File: helpers.py

package info (click to toggle)
silkaj 0.11.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 1,164 kB
  • sloc: python: 6,901; sh: 68; makefile: 30
file content (26 lines) | stat: -rw-r--r-- 931 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Copyright  2016-2022 Maƫl Azimi <m.a@moul.re>
#
# Silkaj is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Silkaj is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Silkaj. If not, see <https://www.gnu.org/licenses/>.

import click

from silkaj import cli


def define_click_context(endpoint=None, gtest=False):
    ctx = click.Context(cli.cli)
    ctx.obj = {}
    ctx.obj["ENDPOINT"] = endpoint
    ctx.obj["GTEST"] = gtest
    click.globals.push_context(ctx)