Webview: init 'open clan' workflow

This commit is contained in:
Johannes Kirschbauer
2024-06-11 16:28:02 +02:00
parent be868ee107
commit 913ab4627c
9 changed files with 288 additions and 15 deletions

View File

@@ -19,7 +19,7 @@ class FileFilter:
@dataclass
class FileRequest:
# Mode of the os dialog window
mode: Literal["open_file", "select_folder"]
mode: Literal["open_file", "select_folder", "save"]
# Title of the os dialog window
title: str | None = None
# Pre-applied filters for the file dialog

View File

@@ -1,6 +1,7 @@
# !/usr/bin/env python3
import argparse
import json
import os
from dataclasses import dataclass, fields
from pathlib import Path
@@ -47,11 +48,16 @@ def create_clan(options: CreateOptions) -> CreateClanResponse:
if not directory.exists():
directory.mkdir()
else:
raise ClanError(
location=f"{directory.resolve()}",
msg="Cannot create clan",
description="Directory already exists",
)
# Directory already exists
# Check if it is empty
# Throw error otherwise
dir_content = os.listdir(directory)
if len(dir_content) != 0:
raise ClanError(
location=f"{directory.resolve()}",
msg="Cannot create clan",
description="Directory already exists and is not empty.",
)
cmd_responses = {}
command = nix_command(