Skip to content

SelfHostedMode #224

@XDFUN

Description

@XDFUN

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

I want to create an app, which is a console in it's own, meaning the .exe isn't called by a command line like cmd or powershell, but is executed directly.
For example creating a Powershell clone.

Note: Everything here described is more of a QoL feature for the user, as it could be confusing or weird to use '--help' without command or exe or anything infront

Describe the solution you'd like
A clear and concise description of what you want to happen.

A mode similar to InteractiveMode, but with some tweaks.

  1. Disable --help/-h/--version on the root and replace by the commands help/?/version
  2. Modifying the help text so the Usage no longer displays the executable and root Options are removed (since help/?/version are moved to the commands)
  3. When executing an unrecognized command, it doesn't print option/argument but unrecognized command

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

  1. I create my own mode, copied Interactive and added an intercept for --help/-h/--version and throw command not found instead -> If for some reason the commands are actually added it would throw without cause
    1.1. I created the commands Help and Version, Version uses the IHelpWriter with a default CommandSchema
  2. Copied DefaultHelpWriter and modified it to leave out the the executable and title in the Usage and not printing Options if it's the root
  3. This I couldn't really intercept, the exception is thrown by the BindInput middleware, which is executed before the user middleware. So I made my own ExceptionHandler. But I can't really differentiate if the argument/parameter wasn't found or if the command was not found. My logic just checks if CommandSchema is the default, which is not ideal and it doesn't work with my own Mode, since it can't initialize the Input for the context

Additional context
Add any other context or screenshots about the feature request here.

I saw that in Typin 4 its planed to extend the DefaultHelpWriter, but that would only allow for some of the logic to work.

The image shows the example where the program IS the console. The prompt uses the current directory + "> "
The error message is rewritten using my custom error handler
The command help was added as actual command and not inserted like it is done with --help/-h/--version

Image

Metadata

Metadata

Assignees

Labels

conceptHelp and further investigation on the proposal is needed.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions