Beispiel #1
0
from pyreadline import Readline
readline = Readline()
Beispiel #2
0
        # return match indexed by state
        try:
            return self.matches[state] + ' '
        except IndexError:
            return None

    def add_options(self, *options):
        "Add options for auto-complate"
        for option in options:
            self.options.append(option)
        self.options = sorted(self.options)


COMPLATER = _Completer()

_READLINE = Readline()
_READLINE.ctrl_c_timeout = 0
_READLINE.set_completer(COMPLATER.complete)
_READLINE.parse_and_bind('tab: complete')


def autocomplate_input(message=''):
    "input-lke function with auto-complate"
    sys.stdout = sys.__stdout__
    input_ = _READLINE.readline(message).strip('\n')
    sys.stdout = open(os.devnull, 'w')
    return input_


class QQ:
    "A simple Queue for storing the system state"
import sys
import subprocess
sys.path.append('Scripts/')
import gdal_merge
import zipfile  
import os
import time
import glob
from pyreadline import Readline
from pathlib import Path

readline = Readline()

def complete(text, state):
    return (glob.glob(text+'*')+[None])[state]


def get_immediate_subdirectories(a_dir):
    return [name for name in os.listdir(a_dir)
            if os.path.isdir(os.path.join(a_dir, name))]


def generate_geotiffs(inputProductPath, outputPath):

	basename =  os.path.basename(inputProductPath)
	if os.path.isdir(outputPath + basename[:-3] + "SAFE") :
		print('Already extracted')
	else:
		zip = zipfile.ZipFile(inputProductPath) 
		zip.extractall(outputPath) 
		print("Extracting Done") 
Beispiel #4
0
            k = fi+1
            for j in range(k, len(command)):
                if command[j] == separator:
                    li = j
                    tokens.append(command[fi+1:li])
                    break
            command = command[li+1:l]
    return tokens

def spawn_list(a_):
    if isinstance(a_,list):
        return a_
    return []

files_list = []
readline = Readline()
def completer(text, state):
    options = [i for i in files_list if i.startswith(text)]
    if state < len(options):
        return options[state]
    else:
        return None

help_cmd = {
    "ls": "List all files and directories in current path",
    "lsdir": "List all directories in current path",
    "commands" : "Get List of All Commands",
    "exit" : "Exit Scanty",
    "cls" : "Clear The Screen",
    "cd" : "Change Directory -> Multi Directory Traversal with slashes may be faulty",
    "setprompt" : "Set prefix of Current Prompt",