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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
use std::path::PathBuf;
use clap::{Parser, Subcommand};
#[derive(Debug, Parser)]
#[clap(
author = "Dimitri Sabadie <hadronized@strongly-typed-thoughts.net>",
name = "ktsctl",
version = env!("VERSION"),
about = "CLI controler for kak-tree-sitter"
)]
pub struct Cli {
#[clap(long)]
pub verbose: bool,
#[clap(subcommand)]
pub cmd: Cmd,
/// Specify a custom user-config.
#[clap(long)]
pub config: Option<PathBuf>,
}
#[derive(Debug, Subcommand)]
pub enum Cmd {
/// Fetch resources.
Fetch {
/// Execute commands for all known languages.
///
/// The list of languages can be seen with `ktsctl query -a`.
#[clap(short, long)]
all: bool,
/// Languages to manage.
///
/// Space separated.
langs: Vec<String>,
},
/// Compile resources.
Compile {
/// Execute commands for all known languages.
///
/// The list of languages can be seen with `ktsctl query --all`.
#[clap(short, long)]
all: bool,
/// Languages to manage.
///
/// Space separated.
langs: Vec<String>,
},
/// Install resources.
Install {
/// Execute commands for all known languages.
///
/// The list of languages can be seen with `ktsctl query -a`.
#[clap(short, long)]
all: bool,
/// Languages to manage.
///
/// Space separated.
langs: Vec<String>,
},
/// Synchronize resources (implies fetch, compile and install).
///
/// This command also checks whether pinned version are already there; if so,
/// nothing is performed.
Sync {
/// Execute commands for all known languages.
///
/// The list of languages can be seen with `ktsctl query -a`.
#[clap(short, long)]
all: bool,
/// Languages to manage.
///
/// Space separated.
langs: Vec<String>,
},
/// Get information on installed resources.
Query {
/// List all known languages and display information about them.
#[clap(short, long)]
all: bool,
/// Get information about a specific language.
lang: Option<String>,
},
/// Remove resources.
///
/// If no flag is passed, -g and -q are assumed. Passing -p will also prune
/// out-of-sync pins; so to completely remove everything for a given language:
///
/// ktsctl rm -p <LANG>
#[clap(aliases = &["rm"])]
Remove {
/// Remove grammar.
#[clap(short, long)]
grammar: bool,
/// Remove queries.
#[clap(short, long)]
queries: bool,
/// Prune resources.
///
/// Pruning resources implies resources deletion for which the pin is out
/// of date.
#[clap(short, long)]
prune: bool,
/// Remove resources for the specific language.
langs: Vec<String>,
},
/// Prune resources.
///
/// This command iterates over all languages’ resources and remove everything that
/// is not pinned in the configuration.
Prune,
/// Print default configuration
DefaultConfig,
}