jirust_cli/utils/macros.rs
1/// Macro to generate the Jira document field for a given text value
2///
3/// # Arguments
4///
5/// * `$v` - The text value to be used in the Jira document field
6///
7/// # Returns
8///
9/// * A string representing the Jira document field
10///
11/// # Example
12///
13/// ```
14/// use jirust_cli::jira_doc_std_field;
15///
16/// assert_eq!(jira_doc_std_field!("This is a test"), "{\"content\":[{\"content\":[{\"text\":\"This is a test\",\"type\":\"text\"}],\"type\":\"paragraph\"}],\"type\":\"doc\",\"version\":1}");
17/// ```
18#[macro_export]
19macro_rules! jira_doc_std_field {
20 ($v:expr_2021) => {
21 format!(
22 "{{\"content\":[{{\"content\":[{{\"text\":\"{}\",\"type\":\"text\"}}],\"type\":\"paragraph\"}}],\"type\":\"doc\",\"version\":1}}", $v).as_str()
23 }
24}