We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fc6e3ca commit ab891b1Copy full SHA for ab891b1
templates/components/what/cli/code-inputs.html.hbs
@@ -1,9 +1,11 @@
1
+use clap::Parser;
2
+
3
/// Read some lines of a file
-#[derive(Debug, StructOpt)]
4
+#[derive(Debug, Parser)]
5
struct Cli {
6
/// Input file to read
7
file: String,
8
/// Number of lines to read
- #[structopt(short = "n")]
9
+ #[structopt(short = 'n')]
10
num: usize,
11
}
templates/components/what/cli/code-main.html.hbs
@@ -1,9 +1,8 @@
-use quicli::prelude::*;
-use structopt::StructOpt;
+use std::{error::Error, fs::read_to_string};
-fn main() -> CliResult {
- let args = Cli::from_args();
- read_file(&args.file)?
+fn main() -> Result<(), Box<dyn Error>> {
+ let args = Cli::parse();
+ read_to_string(&args.file)?
.lines()
.take(args.num)
.for_each(|line| println!("{}", line));
0 commit comments