aboutsummaryrefslogtreecommitdiff
path: root/issues/the-shit-time.md
blob: f830477e90bae59edc1d798972825059e02b53e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Some Situations Where You'd Be Like "Shit!"

This document collects the discomforts currently experienced while using Mingling.

Of course, you can also contribute to this document.

---

## Why is there no fallback completion logic?

(completion) (fallback)

Currently, Mingling's Completion only supports providing completion logic for specific subcommands, with no way to provide global completion.

For example:

```
mycmd <tab>
completion:
--help    -h  --- Display helps
--version -V  --- Display versions
```

Currently, there is no workaround.

Ideal solution:

```rust
#[completion(EntryGlobal)]
fn complete(ctx: &ShellContext) -> Suggest {
    // ...
}
```

---

## Why can't I register descriptions for commands?

(completion) (dispatcher)

Currently, Mingling's Completion cannot register a description for each subcommand.

For example:

```
mycmd <tab>
completion:
add rm list <--- You cannot register descriptions for commands
```

Expected behavior:

```
mycmd <tab>
completion:
add  --- Add something
rm   --- Remove something
list --- List something
```

Ideal solution:

```rust
// It should be able to freely integrate with crates that provide i18n functionality,
// so the following approach cannot be used as a data source for descriptions.
dispatcher! {
    /// Add Something <--- How to i18n?
    "add", CMDAdd => EntryAdd
}

// Ideally, it should satisfy the following two conditions:
// 1. No need to use `with_dispatcher`, because `with_dispatcher` is disabled in `dispatch_tree` mode
// 2. Must be able to accept String or &str at runtime

// Current idea
#[inline(always)]
#[dispatcher_desc(EntryAdd)]
fn desc_add() -> String {
    // If using rust_i18n
    t!("cmd.add.desc")
}

// Collected and generated by `gen_program!()`
// Generate something like get_dispatcher_desc(id: &ThisProgram) -> String
// Match the corresponding function using enum values inside ThisProgram
gen_program!()
```