"""
Some command
"""

from hashlib import sha256

from django.conf import settings
from django.core.management.base import BaseCommand

from ocyan.core.fender import config


def gen_password():
    hasher = sha256()
    hasher.update(b"ocyan_seed_value_Shai8aun")
    hasher.update(settings.SECRET_KEY.encode())
    hasher.update(config.get("django", "username", "superuser").encode())
    return hasher.hexdigest()


class Command(BaseCommand):
    help = __doc__

    def add_arguments(self, parser):
        parser.add_argument("--dry-run", action="store_true")

    def handle(self, *args, **options):
        self.stdout.write("user: %s\n" % config.get("django", "username", "superuser"))
        self.stdout.write("password: %s\n" % gen_password())
