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

CLI changes [CPP-585] #378

Merged
merged 6 commits into from Jan 24, 2022
Merged

CLI changes [CPP-585] #378

merged 6 commits into from Jan 24, 2022

Conversation

notoriaga
Copy link
Contributor

No description provided.

}

#[derive(Serialize, Deserialize)]
struct ConsoleLogPacket<'a> {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A little annoying we have to use this intermediate struct but i can't figure out a way around it within the logging facade. Switching to &str avoids some allocations when reading strings back into this struct

// Min one space plus the longest log level
const MIN_SPACES: usize = "CONSOLE".len() + 1;

let spaces = " ".repeat(MIN_SPACES - packet.level.len());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With tabs everything is "jagged", this is kind of a hack but looks nicer? Could go either way on this

@notoriaga notoriaga changed the title CLI changes [CPP-585] [wip] CLI changes [CPP-585] Jan 19, 2022
Base automatically changed from steve/cpp-586 to main January 20, 2022 22:08
@john-michaelburke
Copy link
Collaborator

I see mentions of Arg Groups here: clap-rs/clap#2621 but it doesn't seem to affect sorting of the help blurb, still would be good for some of our grouped commands. I think for ordering we may be forced to hardcode the help blurb which is kind of a shame. I think we can push that off closer to launch if we happen to add/change any other CLI args until then.

Copy link
Collaborator

@john-michaelburke john-michaelburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rebase then :shipit:

@notoriaga
Copy link
Contributor Author

There is also a way to manually specify the ordering (or make it follow the struct def), but can't figure out how to get the help flags in the right place

@john-michaelburke
Copy link
Collaborator

There is also a way to manually specify the ordering (or make it follow the struct def), but can't figure out how to get the help flags in the right place

Maybe this display_order https://github.com/clap-rs/clap/pull/443/files#diff-561c554f836a4672327d4b2e507d4ff173876ee9b3a6d6623fc0d7aaa649159dR160

@notoriaga
Copy link
Contributor Author

This is what it looks like now

USAGE:
    swift-navigation-console [OPTIONS] [SUBCOMMAND]

OPTIONS:
        --sbp-log <SBP_LOG>
            Log SBP-JSON or SBP data to default / specified log file

        --sbp-log-filename <SBP_LOG_FILENAME>
            Set SBP log filename

        --log-dirname <LOG_DIRNAME>
            Set log directory

        --log-console
            Create a log file containing console debug information

        --csv-log
            Log CSV data to default / specified log file

        --show-csv-log
            Show CSV logging button

        --show-fileio
            Show Filio pane in Update tab

        --show-file-connection
            Allow File Connections

        --settings-yaml <SETTINGS_YAML>
            Path to a yaml file containing known piski settings

        --use-opengl
            Use OpenGL, plots will become optimized for efficiency not aesthetics and require less
            system resources

        --refresh-rate <REFRESH_RATE>
            Change the refresh rate of the plots

        --no-prompts
            Don't show prompts about firmware/console updates

        --exit-after
            Exit when connection closes

        --tab <TAB>
            Start console from specific tab

        --height <HEIGHT>
            Set the height of the main window

        --width <WIDTH>
            Set the width of the main window

    -h, --help
            Print help information

    -V, --version
            Print version information

SUBCOMMANDS:
    serial    
    tcp       
    file      
    help      Print this message or the help of the given subcommand(s)

Ticket didn't mention show-file-connection/no-prompts so not sure if they are in the right spot

#[derive(Parser)]
#[clap(
name = "swift_navigation_console",
about = "Swift Navigation Console.",
version = include_str!("version.txt")
bin_name = BIN_NAME,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the name locally, not sure if that was still and issue with dists?

@notoriaga notoriaga enabled auto-merge (squash) January 24, 2022 22:49
@notoriaga notoriaga changed the title [wip] CLI changes [CPP-585] CLI changes [CPP-585] Jan 24, 2022
@notoriaga notoriaga merged commit 0ba1aed into main Jan 24, 2022
@notoriaga notoriaga deleted the steve/cpp-585 branch January 24, 2022 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants