How to use the plumbum.local.env.get function in plumbum

To help you get started, we’ve selected a few plumbum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
        )
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
        )
    chmod = local['chmod']
    git = local['git']
    debug(chmod(['600', netrc_path]))
    debug(git(['config', '--global', 'user.email', email]))
    debug(git(['config', '--global', 'user.name', name]))
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
        )
    chmod = local['chmod']
    git = local['git']
    debug(chmod(['600', netrc_path]))
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
        )
    chmod = local['chmod']
    git = local['git']
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
        )
    chmod = local['chmod']
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
        )
    chmod = local['chmod']
    git = local['git']
    debug(chmod(['600', netrc_path]))
    debug(git(['config', '--global', 'user.email', email]))
    debug(git(['config', '--global', 'user.name', name]))
    debug(f'username:{github_actor}, branch:{branch}, commit message:{commit_message}')
github github-actions-x / commit / entrypoint.py View on Github external
def run():
    netrc_path = os.path.join(local.env.get('HOME', ''), '.netrc')
    github_actor = local.env.get('GITHUB_ACTOR')
    github_token = local.env.get('INPUT_GITHUB-TOKEN')
    commit_message = local.env.get('INPUT_COMMIT-MESSAGE')
    force_add = local.env.get('INPUT_FORCE-ADD')
    branch = local.env.get('INPUT_PUSH-BRANCH') or local.env.get('GITHUB_REF').split('/')[2]
    rebase = local.env.get('INPUT_REBASE', 'false')
    files = local.env.get('INPUT_FILES', '')
    email = local.env.get('INPUT_EMAIL', f'{github_actor}@users.noreply.github.com')
    name = local.env.get('INPUT_NAME', github_actor)
    with open(netrc_path, 'w') as f:
        f.write(
            f'machine github.com\n'
            f'login {github_actor}\n'
            f'password {github_token}\n'
            f'machine api.github.com\n'
            f'login {github_actor}\n'
github tomerfiliba / plumbum / plumbum / cli / application.py View on Github external
.format(swfuncs[swinfo.func].swname, swname))
            else:
                if swinfo.list:
                    swfuncs[swinfo.func] = SwitchParseInfo(
                        swname, ([val], ), index)
                elif val is NotImplemented:
                    swfuncs[swinfo.func] = SwitchParseInfo(swname, (), index)
                else:
                    swfuncs[swinfo.func] = SwitchParseInfo(
                        swname, (val, ), index)

        # Extracting arguments from environment variables
        envindex = 0
        for env, swinfo in self._switches_by_envar.items():
            envindex -= 1
            envval = local.env.get(env)
            if envval is None:
                continue

            if swinfo.func in swfuncs:
                continue  # skip if overridden by command line arguments

            val = self._handle_argument(envval, swinfo.argtype, env)
            envname = "${0}".format(env)
            if swinfo.list:
                # multiple values over environment variables are not supported,
                # this will require some sort of escaping and separator convention
                swfuncs[swinfo.func] = SwitchParseInfo(envname, ([val], ),
                                                       envindex)
            elif val is NotImplemented:
                swfuncs[swinfo.func] = SwitchParseInfo(envname, (), envindex)
            else: