<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Sudo fabric commands.

:copyright: (c) 2014 by <NAME> <<EMAIL>>
:licence: MIT
:bugreports: <EMAIL>

"""

import configuration as config
from fabric.api import task
from fabric.contrib.files import append
from os.path import splitext, basename

# module configuration ########################################################


MODULE = splitext(basename(__file__))[0]
CONFIGURATION = config.get_configuration(MODULE)


# tasks: need configuration ###################################################

if CONFIGURATION is not None:
    @task
    def allow_passwordless_sudo(username):
        """(SUDO) Enable a user to use sudo without password."""

        sudo_string = "{} ALL=(ALL) NOPASSWD: ALL\n".format(username)
        append("/etc/sudoers", sudo_string, use_sudo=True)<commit_msg>fab/sudo: fix command not shown<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Sudo fabric commands.

:copyright: (c) 2014 by <NAME> <<EMAIL>>
:licence: MIT
:bugreports: <EMAIL>

"""

import configuration as config
from fabric.api import task
from fabric.contrib.files import append
from os.path import splitext, basename

# module configuration ########################################################


MODULE = splitext(basename(__file__))[0]
CONFIGURATION = config.get_configuration(MODULE)


# tasks #######################################################################

@task
def allow_passwordless_sudo(username):
    """(SUDO) Enable a user to use sudo without password."""

    sudo_string = "{} ALL=(ALL) NOPASSWD: ALL\n".format(username)
    append("/etc/sudoers", sudo_string, use_sudo=True)
{'fraction_non_alphanumeric': 0.2529832935560859, 'fraction_numerical': 0.007159904534606206, 'mean_word_length': 5.425287356321839, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '470296', 'n_tokens_mistral': 509, 'n_tokens_neox': 471, 'n_words': 130}