Skip to content

Commit

Permalink
docs: add missing dotnet left menu (#3770)
Browse files Browse the repository at this point in the history
  • Loading branch information
acesyde authored and jdx committed Dec 21, 2024
1 parent ddac57a commit a611aea
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 7 deletions.
31 changes: 31 additions & 0 deletions e2e/tasks/test_task_usage
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash

# tests that "test.sh" gets mapped to "test" except when an existing task is there named "test"
assert "mise task add --file test.sh --description sh"
assert "mise task ls" "test sh"
assert "mise task ls --json" "[
{
\"name\": \"test\",
\"description\": \"sh\",
\"source\": \"$PWD/mise-tasks/test.sh\"
}
]"
assert "mise task ls --usage" 'cmd "test" help="sh"'

assert "mise task add --file test --description no-sh"
assert "mise task ls" "test no-sh
test.sh sh"
assert "mise task ls --json" "[
{
\"name\": \"test\",
\"description\": \"no-sh\",
\"source\": \"$PWD/mise-tasks/test\"
},
{
\"name\": \"test.sh\",
\"description\": \"sh\",
\"source\": \"$PWD/mise-tasks/test.sh\"
}
]"
assert "mise task ls --usage" 'cmd "test" help="no-sh"
cmd "test.sh" help="sh"'
2 changes: 1 addition & 1 deletion src/cli/tasks/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl TasksAdd {
lines.push("#MISE alias=[\"".to_string() + &self.alias.join("\", \"") + "\"]");
}
if let Some(description) = &self.description {
lines.push("#MISE description=".to_string() + description);
lines.push("#MISE description=\"".to_string() + description + "\"");
}
if self.dir.is_some() {
lines.push("#MISE dir=".to_string() + &self.dir.unwrap());
Expand Down
4 changes: 2 additions & 2 deletions src/cli/tasks/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use eyre::Result;
use itertools::Itertools;

use crate::config::Config;
use crate::file::{display_path, display_rel_path};
use crate::file::display_rel_path;
use crate::task::Task;
use crate::toolset::Toolset;
use crate::ui::table::MiseTable;
Expand Down Expand Up @@ -129,7 +129,7 @@ impl TasksLs {
inner.insert("description".to_string(), task.description.into());
inner.insert(
"source".to_string(),
display_path(task.config_source).into(),
task.config_source.to_string_lossy().into(),
);
inner
})
Expand Down
16 changes: 14 additions & 2 deletions src/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,23 @@ impl Task {

/// prints the task name without an extension
pub fn display_name(&self) -> String {
self.name
let display_name = self
.name
.rsplitn(2, '.')
.last()
.unwrap_or_default()
.to_string()
.to_string();
let config = Config::get();
if config
.tasks()
.map(|t| t.contains_key(&display_name))
.unwrap_or_default()
{
// this means another task has the name without an extension so use the full name
self.name.clone()
} else {
display_name
}
}

pub fn is_match(&self, pat: &str) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ Overwrite existing <file>

User to run as

## `filetask`
## `filetask.bat`

- **Usage**: `filetask`
- **Usage**: `filetask.bat`

## `install-dev`

Expand Down

0 comments on commit a611aea

Please sign in to comment.