telety_impl/version/
v0.rs

1use quote::quote;
2use syn::spanned::Spanned as _;
3
4use crate::{Command, command::ParameterIdents};
5
6pub(crate) const VERSION: usize = 0;
7
8/// Replaces `needle` with the path to this item.
9pub const PATH: Command = Command::new(VERSION, "path", |ty| {
10    let ParameterIdents {
11        needle, haystack, ..
12    } = ParameterIdents::new(ty.item().span());
13    let replacement = ty.path();
14
15    let telety_path = ty.options().telety_path();
16
17    Some(quote! {
18        #telety_path::__private::find_and_replace! {
19            $#needle,
20            [#replacement],
21            $($#haystack)*
22        }
23    })
24});
25
26pub(crate) const COMMANDS: &[Command] = &[PATH];