CBielstein / APRSsharp

APRS# - Modern APRS software for the amateur radio community
MIT License
12 stars 5 forks source link

Switch user interface to use command line flags/parameters #62

Closed CBielstein closed 2 years ago

CBielstein commented 3 years ago

Description

Currently, APRS# prompts the user to optionally enter username and password, using default values if the user chooses to not enter any commands. While this is clear, it's a bit verbose and difficult for a user to call in a command line scripting scenario. The number of optional parameters will also grow as APRS# supports an increasing number of scenarios and configurations (user filters, sources, log files, etc.).

Because of this, many command line applications use parameters or flags. This would allow us to change our flow from:

> aprssharp
"Enter callsign:"
> N0CALL
"Enter password:"
> -1
"Begin receiving..."

to a single invocation:

> aprssharp --callsign N0CALL --password -1
"Begin receiving..."

where excluding either of those parameters could use the default value we have already been using.

It may also be nice to have the "short" version of the parameters, though this is less necessary. For example:

> aprsshar -c N0CALL -p -1
"Begin receiving..."

Eventually, this framework will expand to support receiving from different sources such as a hardware connector (that is a "TNC"), maybe decoding from a file or string passed om the command line or even sending via a TNC connection. Not to be implemented now but should be kept in mind for the future.

Implementation Notes

Though it's possible to do this by manually parsing the args string array in public static main(string[] args), we likely want to approach this in a more sustainable way. There are several libraries already around and I'm sure many of them would do the trick nicely.

One in particular that looks interesting is under development by the .NET folks already and is called System.CommandLine (GitHub repo, nuget.org listing). Since they support .NET Standard 2.0, we should be good to use them. It might be a good place to start investigating as it may become the new standard going forward. If there is a reason it won't work or that we should use something else, we should discuss and make a decision from there.

Acceptance Criteria

To consider this issue complete the following items must be completed and checked in:

Nice to have but not required: