r'''Clear current screen.
'''
from api.exploit import Exploit, Cmdline
from api import config
import argparse
import os

class exploit(Exploit):
    def __init__(self):
        self.parse = argparse.ArgumentParser(prog='clear', description='Clear current screen.')
        self.help = __doc__ + self.parse.format_help()

    def support(self, session)-> bool:
        '''判断当前命令是否支持指定的session， 一般来说session即为运行改命令时的session
        '''
        self.session = session
        return True

    def run(self, args: Cmdline)-> int:
        args = self.parse.parse_args(args.options)
        os.system('clear' if config.shell not in ('cmd', 'powershell') else 'cls')
        return self.SUCCESS