Fork me on GitHub
  ▖     
▃▀▄▄▖▄▄▖
 ▀▖     
        


#!/usr/bin/env python3
#
# usage: plash parent CONTAINER
# Prints the containers parent container.
#
# Example:
# $ plash parent 89
# 88

from os.path import basename, dirname
from sys import argv

from plash.utils import die, die_with_usage, handle_help_flag, nodepath_or_die

handle_help_flag()

try:
    container = argv[1]
except IndexError:
    die_with_usage()

if container == '0':
    die('the root container has no parent, you fool')

nodepath = nodepath_or_die(container)
print(basename(dirname(nodepath)))