Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command-Line Interface #30

Open
ArchLeaders opened this issue Jun 7, 2023 · 3 comments
Open

Command-Line Interface #30

ArchLeaders opened this issue Jun 7, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ArchLeaders
Copy link
Member

ArchLeaders commented Jun 7, 2023

General discussion and proposals for the CLI (command line interface) implementation.

@ArchLeaders ArchLeaders converted this from a draft issue Jun 7, 2023
@ArchLeaders ArchLeaders added the enhancement New feature or request label Jun 7, 2023
@ArchLeaders
Copy link
Member Author

Usage proposal

nx-editor.exe <action> <input_file> [-f|--flags] FLAGS

Action

Actions can be defined in the ReactiveEditor impl via a common interface (ICommandModel) and/or in a global action process for file-type agonistic actions (e.g. De/CompressZs).

e.g.

public class SarcViewModel : ReactiveEditor, ICommandModel
{
    // . . .
    
    public Task ICommandModel.ProcessAction(string actionName, Dictionary<char, string> flags)
    {
         // Could also be automatically
         // processed with reflection
         return actionName switch {
             "Extract" => ExtractFile(flags['k']),
             _ => throw new Exception($"Action {actionName} was not found")
         };
    }
    
    // . . .
}

Input File

The source (input) file used to identify the ReactiveEditor and consequently operate actions on.

Flags

An infinite array of [-x|--xx] XXX type flag arrangements specific to each ReactiveEditor/Action.

e.g. for SarcViewModel

[-k|--key] KEY
--key "Some/Sarc/Path"

Documentation

Given the modularity and verbosity of the rest of this system, it would follow that the docs could also be auto-generated from the current state of editors/actions.

This might prove difficult with the current proposal, so further discussion should follow once we have a clearer implementation spec.

@ArchLeaders
Copy link
Member Author

Other Notes

A CLI-safe abstraction of the ReactiveEditor may be a good idea to avoid complications with UI code while still maintaining the same organization of parsers.

This might be possible by just casting to an interface level (ICommandModel) and moving some implementations around (mainly the ctor) to give the required access to the interface.

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant