args = parser.parse_args()

if len(args.residuals) > 0 or args.help:
  io.println(io.Yellow("usage:"), args.package, "view <executable> [-h]")
  io.exitSuccess()

target_packages = list()
target_executables = list()

if args.package == 'all':

  package_clear = True

  for package in pkg.packages:
    if io.runCommandMuted("screen -ls | grep {}".format(package)):
      io.printAsync(io.Empty(), "checking executables in ", package, "..", io.Progress())
      stdout = subprocess.check_output(["screen", "-ls | grep", package]).decode("utf-8")
      executables = re.findall('__([a-z + _]+)', stdout)
      if len(executables)>0:
        for executable in executables:
          if package_clear:
            io.println(io.Warn(), "some packages are running:")
            package_clear = False

          target_packages.append(package)
          target_executables.append(executable)
          io.println(io.WarnList(), executable, "in", package)

  if len(target_executables) == 0:
    string = io.println(io.Fail(), "no executable is running")
    io.exitSuccess()
Exemplo n.º 2
0
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='none')
parser.add_argument('command')
parser.add_argument('executable', nargs='?', default='none')
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "view <executable> [-h]")
    io.exitSuccess()

if args.executable == 'none':
    if io.runCommandMuted("screen -ls | grep {}".format(args.package)):
        io.printAsync(io.Empty(), "checking executables in ", args.package,
                      "..", io.Progress())
        stdout = subprocess.check_output(
            ["screen", "-ls | grep", args.package]).decode("utf-8")
        executables = re.findall('__([a-z + _]+)', stdout)
        if len(executables) > 0:
            for executable in executables:
                io.println(io.Success(), executable, "is running")

    else:
        io.println(io.Fail(), "no executable is running")

    io.exitSuccess()

io.printAsync(io.Empty(), "checking executable..", io.Progress())
if io.runCommandMuted("screen -ls | grep {}__{}".format(
        args.package, args.executable)):
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='all')
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

# if args.package == 'all':
#   import kuro_reset_all

if len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "reset [-h]")
    io.exitFail()

io.printAsync(io.Empty(), "checking package..", io.Progress())
if not pkg.packageIsDir(args.package):
    io.println(io.Fail(), args.package, "does not exist")
    io.exitFail()

if not pkg.packageIsGitRepository(args.package):
    io.println(io.Fail(), args.package, "is not a git repository")
    io.exitFail()

repo = pkg.getPackageRepo(args.package)

if not pkg.repoIsNotClean(repo):
    io.println(io.Success(), "done, nothing to be reset in", args.package)
    io.exitSuccess()

string = io.scanln(io.Warn(), "are you sure you want to reset", args.package,
import pkgutils as pkg

import argparse

parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='all')
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "status [-h]")
    io.exitFail()

io.printAsync(io.Empty(), "checking package..", io.Progress())
if not pkg.packageIsDir(args.package):
    io.println(io.Fail(), args.package, "does not exist")
    io.exitFail()

if not pkg.packageIsGitRepository(args.package):
    io.println(io.Fail(), args.package, "is not a git repository")
    io.exitFail()

repo = pkg.getPackageRepo(args.package)

package_clear = True

io.printAsync(io.Empty(), "checking untracked files in", args.package, "\b..",
              io.Progress())
untracked_files = repo.untracked_files
Exemplo n.º 5
0
import datetime
import os

parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default="")
parser.add_argument('message', nargs='?', default="")
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if args.package == 'all' or len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "commit [message] [-h]")
    io.exitFail()

io.printAsync(io.Empty(), "checking package..", io.Progress())
if not pkg.packageIsDir(args.package):
    io.println(io.Fail(), args.package, "does not exist")
    io.exitFail()

if not pkg.packageIsGitRepository(args.package):
    io.println(io.Fail(), args.package, "is not a git repository")
    io.exitFail()

repo = pkg.getPackageRepo(args.package)

io.printAsync(io.Empty(), "checking last commit date..", io.Progress())

try:
    committed_time = datetime.datetime.fromtimestamp(
        repo.head.commit.committed_date)
Exemplo n.º 6
0
import os

parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='none')
parser.add_argument('command')
parser.add_argument('executable', nargs='?', default='none')
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if args.package == 'none' or args.executable == 'none' or len(
        args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "run <executable> [-h]")
    io.exitFail()

io.printAsync(io.Empty(), "checking executable..", io.Progress())
if io.runCommandMuted("screen -ls | grep {}__{}".format(
        args.package, args.executable)):

    io.println(io.Warn(), args.executable, "in", args.package, "has been run")
    string = io.scanln(io.Warn(), "do you want to kill it? (yes/no):")
    io.newLine()

    if string == 'no':
        io.println(io.Fail(), "cancelled")
        io.exitFail()
    elif string != 'yes':
        io.println(io.Fail(), "invalid input, cancelled")
        io.exitFail()

    io.printAsync(io.Empty(), "killing executable..", io.Progress())
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if args.package != 'all' or len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), "kuro pull [-h]")
    io.exitFail()

all_clear = True

for package in pkg.packages:

    package_clear = True

    io.printAsync(io.Empty(), "checking package..", io.Progress())
    if not pkg.packageIsDir(package):
        io.println(io.Fail(), package, "does not exist")
        all_clear = False
        continue

    if not pkg.packageIsGitRepository(package):
        io.println(io.Fail(), package, "is not a git repository")
        all_clear = False
        continue

    repo = pkg.getPackageRepo(package)

    io.printAsync(io.Empty(), "checking remotes..", io.Progress())
    if 'origin' not in repo.remotes:
        io.println(io.Fail(), package, "does not have origin remote")
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='all')
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

# if args.package == 'all':
#   import kuro_push_all

if args.package == 'all' or len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), args.package, "push [-h]")
    io.exitFail()

io.printAsync(io.Empty(), "checking package..", io.Progress())
if not pkg.packageIsDir(args.package):
    io.println(io.Fail(), args.package, "does not exist")
    io.exitFail()

if not pkg.packageIsGitRepository(args.package):
    io.println(io.Fail(), args.package, "is not a git repository")
    io.exitFail()

repo = pkg.getPackageRepo(args.package)

io.printAsync(io.Empty(), "checking remotes..", io.Progress())
if 'origin' not in repo.remotes:
    io.println(io.Fail(), args.package, "does not have origin remote")
    io.exitFail()
Exemplo n.º 9
0
import argparse

parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='all')
parser.add_argument('count', nargs='?', default='5')
parser.add_argument('residuals', nargs='*', default=[ ])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if args.package == 'all' or len(args.residuals) > 0 or args.help:
  io.println(io.Yellow("usage:"), args.package, "log [-h]")
  io.exitFail()

io.printAsync(io.Empty(), "checking package..", io.Progress())
if not pkg.packageIsDir(args.package):
  io.println(io.Fail(), args.package, "does not exist")
  io.exitFail()

if not pkg.packageIsGitRepository(args.package):
  io.println(io.Fail(), args.package, "is not a git repository")
  io.exitFail()

repo = pkg.getPackageRepo(args.package)

io.printAsync(io.Empty(), "getting commits..", io.Progress())
commits = list(repo.iter_commits(repo.active_branch, max_count=args.count))

if len(commits) < 1:
  io.println(io.Warn(), "no commit found in", args.package)
Exemplo n.º 10
0
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('package', nargs='?', default='none')
parser.add_argument('residuals', nargs='*', default=[ ])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if len(args.residuals) > 0 or args.package != 'all'or args.help:
  io.println(io.Yellow("usage:"), "kuro clean [-h]")
  io.exitFail()

directories = ['build', 'install', 'log']
directories_to_clean = []

io.printAsync(io.Empty(), "checking directories..", io.Progress())
for directory in directories:
  if os.path.exists(os.path.join(pkg.workspace_path, directory)):
    directories_to_clean.append(directory)

if len(directories_to_clean) < 1:
  io.println(io.Success(), "already cleaned")
  io.exitSuccess()

string = io.scanln(io.Warn(), "are you sure you want to clean the workspace? (yes/no)")
io.newLine()

if string == 'no':
  io.println(io.Fail(), "cancelled")
  io.exitFail()
elif string != 'yes':
parser.add_argument('residuals', nargs='*', default=[])
parser.add_argument('command')
parser.add_argument('-h', '--help', action='store_true')
args = parser.parse_args()

if args.package != 'all' or len(args.residuals) > 0 or args.help:
    io.println(io.Yellow("usage:"), "kuro clone [-h]")
    io.exitFail()

all_clear = True

for package in pkg.packages:

    avaliable_pkg = False

    io.printAsync(io.Empty(), "checking package..", io.Progress())
    if not pkg.packageIsDir(package):
        for package_check in pkg.packages:
            if package == package_check:
                avaliable_pkg = True
                break

    if not avaliable_pkg:
        io.println(io.Fail(), package, "does not exist")
        continue

    if pkg.packageIsGitRepository(package):
        io.println(io.Success(), package, "already cloned")
        continue

    if avaliable_pkg: