<commit_before>#! /user/bin/env python3
#
# Copycenter [2015-08-06], ISC, [Ampling] 


import argparse
from glob import glob
import subprocess
import os
import sys


# CONFIG
PASSWORD_STORE_DIR = '.password-store/'

# global veriables
home = os.path.expanduser("~")
store = home + "/" + PASSWORD_STORE_DIR


#loop
def loop(): #{
    global entry_list
    for file in entry_list:
        global path
        names = glob(store+"/"+file+"*")
        global name
        name = names[0]
        clip()
#}

# shell magic
def clip(): #{
    global store
    global name
    afile = name.replace(store, '', 1)
    os.environ['afile'] = afile
    print(afile)
    #subprocess.call('pass $afile | xclip -l 1 -quiet -selection clipboard',shell=True)
#}


# Define Options
def main(): #{
    parser = argparse.ArgumentParser(description='Select some files')
    parser.add_argument("entry", help="Sends the entry to Xclip",
            type=str)
    #parser.add_argument("path", "path",help="path/to/file",
    #        type=str)
    args = parser.parse_args()
    
    global entry_list
    entry_list = list(str(args.entry))
    


    #entry_count = (len(entry_list))
    #print(entry_list[entry_count - 1])
#}

if __name__ == '__main__':
    main()
    loop()<commit_msg>added funtions: _copyXclip, reclip<commit_after>#! /user/bin/env python3

# Copycenter [2015-08-06], ISC, [Ampling] 


from subprocess import call, Popen, PIPE
from glob import glob
import argparse
import sys
import os
import gpgme


# CONFIGURABLE {
# Password Files:-$HOME/
PASSWORD_STORE_DIR = '.password-store/test'
# Let pass handle gpg
use_Pass = 1
#}

# global veriables #{
home = os.path.expanduser("~")
store = home + "/" + PASSWORD_STORE_DIR + "/"
#}

#
# BEGIN helper functions
#

#{ shell to Xclip
def _copyXclip(text):
        p = Popen(['xclip', '-selection', 'c', '-l', '1', '-quiet'], stdin=PIPE,
                close_fds=True)
        p.communicate(input=text.encode('utf-8'))
#}

#{ shell to pass
def _pass(text):
        p = Popen(['pass', ''], stdin=PIPE,
                close_fds=True)
        p.communicate(input=text.encode('utf-8'))
#}



#
# BEGIN platform definable
#

#entry
def entry(): #{
    global entry_file
    for file in entry_file:
        global path
        names = glob(store+"/"+file+"*.gpg")
        global name
        name = names[0]
        reclip()
#}


def reclip(): #{  reclip it
    global store
    global name
    afile = name.replace(store, '', 1)
    os.environ['afile'] = afile
    _copyXclip(afile)
#}


#{ Define Options
def main():
    parser = argparse.ArgumentParser(description='Select some files', prog='passel')
    parser.add_argument("entry", help="Sends the entry to Xclip",
            type=str)
    #parser.add_argument("path", "path",help="path/to/file",
    #        type=str)
    args = parser.parse_args()
    
    global entry_file
    entry_file = list(str(args.entry))
    

    #entry_count = (len(entry_file))
    #print(entry_file[entry_count - 1])
#}

if __name__ == '__main__':
    main()
    entry()
{'fraction_non_alphanumeric': 0.1477832512315271, 'fraction_numerical': 0.009523809523809525, 'mean_word_length': 2.9558441558441557, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6011337', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1050, 'n_words': 244}