aboutsummaryrefslogtreecommitdiff
path: root/mingling_macros/src/lib.rs
diff options
context:
space:
mode:
authorWeicao-CatilGrass <1992414357@qq.com>2026-04-27 11:09:35 +0800
committerWeicao-CatilGrass <1992414357@qq.com>2026-04-27 11:29:26 +0800
commitae91bf2f6412edee65660085811248e0127fa97b (patch)
tree504a055510a7592e64ec382cbef97cded7c7e69f /mingling_macros/src/lib.rs
parent704eb899babd85125d29cf41315e9df90515046f (diff)
Remove `marker::NextProcess` and generate it via `gen_program!`
Diffstat (limited to 'mingling_macros/src/lib.rs')
-rw-r--r--mingling_macros/src/lib.rs26
1 files changed, 15 insertions, 11 deletions
diff --git a/mingling_macros/src/lib.rs b/mingling_macros/src/lib.rs
index 58d4e28..f9be1de 100644
--- a/mingling_macros/src/lib.rs
+++ b/mingling_macros/src/lib.rs
@@ -131,18 +131,22 @@ pub fn gen_program(input: TokenStream) -> TokenStream {
let name = read_name(&input);
#[cfg(feature = "comp")]
- let out = TokenStream::from(quote! {
+ let comp_gen = quote! {
::mingling::macros::program_comp_gen!(#name);
- ::mingling::macros::program_fallback_gen!(#name);
- ::mingling::macros::program_final_gen!(#name);
- });
+ };
+
#[cfg(not(feature = "comp"))]
- let out = TokenStream::from(quote! {
+ let comp_gen = quote! {};
+
+ TokenStream::from(quote! {
+ // Shit, this feature is unstable
+ // pub type NextProcess = impl Into<::mingling::ChainProcess<#name>>;
+ pub type NextProcess = ::mingling::ChainProcess<#name>;
+
+ #comp_gen
::mingling::macros::program_fallback_gen!(#name);
::mingling::macros::program_final_gen!(#name);
- });
-
- out
+ })
}
#[proc_macro]
@@ -153,7 +157,7 @@ pub fn program_comp_gen(input: TokenStream) -> TokenStream {
#[cfg(feature = "async")]
let fn_exec_comp = quote! {
#[::mingling::macros::chain(#name)]
- pub async fn __exec_completion(prev: CompletionContext) -> NextProcess {
+ pub async fn __exec_completion(prev: CompletionContext) -> ::mingling::ChainProcess<#name> {
let read_ctx = ::mingling::ShellContext::try_from(prev.inner);
match read_ctx {
Ok(ctx) => {
@@ -168,7 +172,7 @@ pub fn program_comp_gen(input: TokenStream) -> TokenStream {
#[cfg(not(feature = "async"))]
let fn_exec_comp = quote! {
#[::mingling::macros::chain(#name)]
- pub fn __exec_completion(prev: CompletionContext) -> NextProcess {
+ pub fn __exec_completion(prev: CompletionContext) -> ::mingling::ChainProcess<#name> {
let read_ctx = ::mingling::ShellContext::try_from(prev.inner);
match read_ctx {
Ok(ctx) => {
@@ -185,7 +189,7 @@ pub fn program_comp_gen(input: TokenStream) -> TokenStream {
use __completion_gen::*;
pub mod __completion_gen {
use super::*;
- use mingling::marker::NextProcess;
+
::mingling::macros::dispatcher!(#name, "__comp", CompletionDispatcher => CompletionContext);
::mingling::macros::pack!(
#name,