Beispiel #1
0
def main():
    conf = Config("rs-issue")
    conf.add_option("-l", "--limit", dest="limit", action="store", type="int", help="number of results to return.")
    conf.add_option("-o", "--offset", dest="offset", action="store", type="int", help="skip this number of records.")
    conf.add_option("-s", "--sort", dest="sort", action="store", help="sort the results on column.")
    conf.add_option("--status-id", dest="qs_status_id", help="the name of the status state, e.g. closed.")
    conf.add_option("--project-id", dest="qs_project_id", help="the name of the project e.g. rc-support.")
    conf.add_option("--tracker-id", dest="qs_tracker_id", help="the name of the tracker e.g. support.")
    opts, args = conf.parse_args()
    # Here would be a good place to check what came in on the command
    # line and call optp.error("Useful message") to exit if all it not
    # well.
    util.configure_logging(opts.verbose)

    query = {}
    for qs in dir(opts):
        if qs.startswith("qs_"):
            name = qs[3:]
            query[name] = getattr(opts, qs)

    client = IssueClient(opts.url, opts.api_key)
    result = client.query(query)

    from prettytable import PrettyTable

    x = PrettyTable(field_names=["ID", "Tracker", "Status", "Priority", "Title", "Assigned To"])
    for row in result["issues"]:
        if "assigned_to" in row:
            assigned_to = row["assigned_to"]["name"]
        else:
            assigned_to = ""
        x.add_row(
            [
                row["id"],
                row["tracker"]["name"],
                row["status"]["name"],
                row["priority"]["name"],
                row["subject"],
                assigned_to,
            ]
        )
    print str(x)
Beispiel #2
0
import shutil
from os import getcwd
from sys import argv

try:
    from folder import Folder
    from config import Config
    from logger import Logger
    from harsh_null import Null
except ImportError as e:
    raise exception.ModuleMissingError(e)


# Inits
config = Config()
config.parse_args(argv)
log = Logger(
    current_level=config.get_value("log_level"),
    output_loc=config.get_value("log_location"),
    output_style=config.get_value("output_style"),
)
master_dir = Null()
working_dir = Null()
server_dir = Null()
web_dir = Null()
backup_dir = Null()
folders = Null()


def init():
    log("Initialising folders.....")