豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Commit 06899c0

Browse files
committed
chore: lint
1 parent 324151a commit 06899c0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+170
-189
lines changed

src/command_utils.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::errors::KeeperError;
22
use colored::Colorize;
3-
use error_stack::{IntoReport, Result, ResultExt};
3+
use error_stack::{IntoReport, Report, ResultExt};
44
use std::collections::HashMap;
55
use std::io;
66
use std::io::{Read, Write};
@@ -39,11 +39,11 @@ pub fn run_command(
3939
command_name: &str,
4040
args: &[&str],
4141
verbose: bool,
42-
) -> Result<CommandOutput, KeeperError> {
42+
) -> Result<CommandOutput, Report<KeeperError>> {
4343
run_command_with_env_vars(command_name, args, &None, &None, verbose)
4444
}
4545

46-
pub fn run_command_line(command_line: &str, verbose: bool) -> Result<CommandOutput, KeeperError> {
46+
pub fn run_command_line(command_line: &str, verbose: bool) -> Result<CommandOutput, Report<KeeperError>> {
4747
let command_and_args = shlex::split(command_line).unwrap();
4848
// command line contains pipe or not
4949
if command_and_args
@@ -66,17 +66,15 @@ pub fn run_command_line(command_line: &str, verbose: bool) -> Result<CommandOutp
6666
.bold()
6767
.red()
6868
);
69-
Err(KeeperError::CommandNotFound(
70-
command_name.to_string()
71-
).into_report())
69+
Err(KeeperError::CommandNotFound(command_name.to_string()).into_report())
7270
}
7371
}
7472

7573
pub fn run_command_line_from_stdin(
7674
command_line: &str,
7775
input: &str,
7876
verbose: bool,
79-
) -> Result<CommandOutput, KeeperError> {
77+
) -> Result<CommandOutput, Report<KeeperError>> {
8078
let command_and_args = shlex::split(command_line).unwrap();
8179
let command_name = &command_and_args[0];
8280
let args: Vec<&str> = if command_and_args.len() > 1 {
@@ -117,9 +115,7 @@ pub fn run_command_line_from_stdin(
117115
.bold()
118116
.red()
119117
);
120-
Err(KeeperError::CommandNotFound(
121-
command_name.to_string()
122-
).into_report())
118+
Err(KeeperError::CommandNotFound(command_name.to_string()).into_report())
123119
}
124120
}
125121

@@ -129,7 +125,7 @@ pub fn run_command_with_env_vars(
129125
working_dir: &Option<String>,
130126
env_vars: &Option<HashMap<String, String>>,
131127
verbose: bool,
132-
) -> Result<CommandOutput, KeeperError> {
128+
) -> Result<CommandOutput, Report<KeeperError>> {
133129
let mut command = Command::new(command_name);
134130
command.envs(std::env::vars());
135131
if args.len() > 0 {
@@ -161,7 +157,7 @@ pub fn run_command_with_env_vars(
161157
pub fn run_command_by_shell(
162158
command_line: &str,
163159
verbose: bool,
164-
) -> Result<CommandOutput, KeeperError> {
160+
) -> Result<CommandOutput, Report<KeeperError>> {
165161
let mut command = if cfg!(target_os = "windows") {
166162
Command::new("cmd")
167163
} else {
@@ -186,7 +182,7 @@ pub fn run_command_by_shell(
186182
.change_context(KeeperError::FailedToRunTasks(format!("{:?}", command)))
187183
}
188184

189-
pub fn intercept_output(command: &mut Command) -> Result<CommandOutput, KeeperError> {
185+
pub fn intercept_output(command: &mut Command) -> Result<CommandOutput, Report<KeeperError>> {
190186
let mut child = command
191187
.stdin(Stdio::inherit())
192188
.stdout(Stdio::piped())
@@ -244,7 +240,7 @@ pub fn intercept_output(command: &mut Command) -> Result<CommandOutput, KeeperEr
244240
})
245241
}
246242

247-
pub fn capture_command_output(command_name: &str, args: &[&str]) -> Result<Output, KeeperError> {
243+
pub fn capture_command_output(command_name: &str, args: &[&str]) -> Result<Output, Report<KeeperError>> {
248244
let mut command = Command::new(command_name);
249245
if args.len() > 0 {
250246
command.args(args);

src/common/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
pub mod pyproject;
21
pub mod notification;
2+
pub mod pyproject;
33

44
use crate::errors::KeeperError;
5-
use error_stack::{Result, ResultExt};
5+
use error_stack::{Report, ResultExt};
66
use serde::{Deserialize, Serialize};
77
use std::{collections::HashMap, fs};
88

@@ -14,7 +14,7 @@ pub struct PackageJson {
1414
pub package_manager: Option<String>,
1515
}
1616

17-
pub fn parse_package_json() -> Result<PackageJson, KeeperError> {
17+
pub fn parse_package_json() -> core::result::Result<PackageJson, Report<KeeperError>> {
1818
let content = fs::read_to_string(
1919
&std::env::current_dir()
2020
.expect("Failed to get current directory")

src/keeper.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::models::Task;
44
use crate::runners::RUNNERS;
55
use crate::{managers, runners};
66
use colored::Colorize;
7-
use error_stack::Result;
7+
use error_stack::{Report};
88
use std::collections::HashMap;
99

1010
pub fn run_tasks(
@@ -13,7 +13,7 @@ pub fn run_tasks(
1313
task_args: &[&str],
1414
global_args: &[&str],
1515
verbose: bool,
16-
) -> Result<i32, KeeperError> {
16+
) -> core::result::Result<i32, Report<KeeperError>> {
1717
let mut task_count = 0;
1818
let all_tasks = list_all_runner_tasks(true);
1919
if let Ok(tasks_hashmap) = all_tasks {
@@ -106,7 +106,7 @@ pub fn run_manager_task(
106106
task_args: &[&str],
107107
global_args: &[&str],
108108
verbose: bool,
109-
) -> Result<(), KeeperError> {
109+
) -> Result<(), Report<KeeperError>> {
110110
managers::run_task(runner, task_name, task_args, global_args, verbose)
111111
}
112112

src/managers/amper.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use which::which;
66

@@ -38,7 +38,7 @@ pub fn run_task(
3838
_task_args: &[&str],
3939
_global_args: &[&str],
4040
verbose: bool,
41-
) -> Result<CommandOutput, KeeperError> {
41+
) -> Result<CommandOutput, Report<KeeperError>> {
4242
if let Some(command_line) = get_task_command_map().get(task) {
4343
run_command_line(command_line, verbose)
4444
} else {

src/managers/bazel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use which::which;
66

@@ -32,7 +32,7 @@ pub fn run_task(
3232
_task_args: &[&str],
3333
_global_args: &[&str],
3434
verbose: bool,
35-
) -> Result<CommandOutput, KeeperError> {
35+
) -> Result<CommandOutput, Report<KeeperError>> {
3636
if let Some(command_line) = get_task_command_map().get(task) {
3737
run_command_line(command_line, verbose)
3838
} else {

src/managers/bld.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use which::which;
66

@@ -33,7 +33,7 @@ pub fn run_task(
3333
_task_args: &[&str],
3434
_global_args: &[&str],
3535
verbose: bool,
36-
) -> Result<CommandOutput, KeeperError> {
36+
) -> Result<CommandOutput, Report<KeeperError>> {
3737
if let Some(command_line) = get_task_command_map().get(task) {
3838
run_command_line(command_line, verbose)
3939
} else {

src/managers/bundler.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use which::which;
66

@@ -31,7 +31,7 @@ pub fn run_task(
3131
_task_args: &[&str],
3232
_global_args: &[&str],
3333
verbose: bool,
34-
) -> Result<CommandOutput, KeeperError> {
34+
) -> Result<CommandOutput, Report<KeeperError>> {
3535
if let Some(command_line) = get_task_command_map().get(task) {
3636
run_command_line(command_line, verbose)
3737
} else {

src/managers/cargo.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use which::which;
66

@@ -40,7 +40,7 @@ pub fn run_task(
4040
_task_args: &[&str],
4141
_global_args: &[&str],
4242
verbose: bool,
43-
) -> Result<CommandOutput, KeeperError> {
43+
) -> Result<CommandOutput, Report<KeeperError>> {
4444
if let Some(command_line) = get_task_command_map().get(task) {
4545
run_command_line(command_line, verbose)
4646
} else {

src/managers/cmakeconan.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use which::which;
66

@@ -57,7 +57,7 @@ pub fn run_task(
5757
_task_args: &[&str],
5858
_global_args: &[&str],
5959
verbose: bool,
60-
) -> Result<CommandOutput, KeeperError> {
60+
) -> Result<CommandOutput, Report<KeeperError>> {
6161
if task == "build" {
6262
if !std::env::current_dir()
6363
.map(|dir| dir.join("cmake-build-debug").exists())

src/managers/composer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::command_utils::{run_command_line, CommandOutput};
22
use crate::errors::KeeperError;
3-
use error_stack::{IntoReport, Result};
3+
use error_stack::{IntoReport, Report};
44
use std::collections::HashMap;
55
use std::env::current_dir;
66
use which::which;
@@ -52,7 +52,7 @@ pub fn run_task(
5252
_task_args: &[&str],
5353
_global_args: &[&str],
5454
verbose: bool,
55-
) -> Result<CommandOutput, KeeperError> {
55+
) -> Result<CommandOutput, Report<KeeperError>> {
5656
if let Some(command_line) = get_task_command_map().get(task) {
5757
run_command_line(command_line, verbose)
5858
} else {

0 commit comments

Comments
 (0)