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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
use clap::Parser;
use std::path::PathBuf;
#[derive(Parser, Debug)]
#[command(name = "hoardom", version = "0.0.1", about = "Domain hoarding made less painful")]
#[command(disable_help_flag = true, disable_version_flag = true)]
pub struct Args {
/// One or more domain names to search for
#[arg(value_name = "DOMAIN")]
pub domains: Vec<String>,
// -- Mode --
/// Default non interactive mode
#[arg(long = "cli", default_value_t = false)]
pub cli_mode: bool,
/// Easy to use Terminal based Graphical user interface
#[arg(long = "tui", default_value_t = false)]
pub tui_mode: bool,
// -- Basics --
/// Define where environement file should be saved
#[arg(short = 'e', long = "environement")]
pub env_path: Option<PathBuf>,
/// Show all in list even when unavailable
#[arg(short = 'a', long = "all", default_value_t = false)]
pub show_all: bool,
// -- Advanced --
/// Out in CSV, Path is optional. If path isnt given will be printed to terminal with no logs
#[arg(short = 'c', long = "csv")]
pub csv: Option<Option<PathBuf>>,
/// Built in TLD list to use (from Lists.toml)
#[arg(short = 'l', long = "list")]
pub tld_list: Option<String>,
/// Import a custom toml list for this session
#[arg(short = 'i', long = "import-filter")]
pub import_filter: Option<PathBuf>,
/// Set certain TLDs to show up as first result (comma separated)
#[arg(short = 't', long = "top", value_delimiter = ',')]
pub top_tlds: Option<Vec<String>>,
/// Only search these TLDs (comma separated)
#[arg(short = 'o', long = "onlytop", value_delimiter = ',')]
pub only_top: Option<Vec<String>>,
/// How many suggestions to look up and try to show (defaults to 0 aka disabled)
#[arg(short = 's', long = "suggestions")]
pub suggestions: Option<usize>,
// -- Various --
/// Number of concurrent lookup requests (default: 1)
#[arg(short = 'j', long = "jobs")]
pub jobs: Option<u8>,
/// Set the global delay in seconds between lookup requests
#[arg(short = 'D', long = "delay")]
pub delay: Option<f64>,
/// Retry NUMBER amount of times if domain lookup errors out
#[arg(short = 'R', long = "retry")]
pub retry: Option<u32>,
/// Verbose output for debugging
#[arg(short = 'V', long = "verbose", default_value_t = false)]
pub verbose: bool,
/// Search for names/domains in text file, one domain per new line
#[arg(short = 'A', long = "autosearch")]
pub autosearch: Option<PathBuf>,
/// Use a monochrome color scheme
#[arg(short = 'C', long = "no-color", default_value_t = false)]
pub no_color: bool,
/// Do not use unicode only plain ASCII
#[arg(short = 'U', long = "no-unicode", default_value_t = false)]
pub no_unicode: bool,
/// Disable the mouse integration for TUI
#[arg(short = 'M', long = "no-mouse", default_value_t = false)]
pub no_mouse: bool,
/// Force refresh the RDAP bootstrap cache
#[arg(short = 'r', long = "refresh-cache", default_value_t = false)]
pub refresh_cache: bool,
/// Basic Help
#[arg(short = 'h', long = "help", default_value_t = false)]
pub help: bool,
/// Show full help
#[arg(short = 'H', long = "fullhelp", default_value_t = false)]
pub fullhelp: bool,
}
impl Args {
pub fn is_tui(&self) -> bool {
self.tui_mode
}
pub fn effective_list(&self) -> String {
self.tld_list
.clone()
.map(|s| s.to_lowercase())
.unwrap_or_else(|| crate::tlds::default_list_name().to_string())
}
pub fn effective_suggestions(&self) -> usize {
self.suggestions.unwrap_or(0)
}
pub fn effective_retry(&self) -> u32 {
self.retry.unwrap_or(1)
}
pub fn effective_delay(&self) -> f64 {
self.delay.unwrap_or(0.0)
}
pub fn effective_jobs(&self) -> u8 {
self.jobs.unwrap_or(1).max(1)
}
}
pub fn print_help() {
println!(
"hoardom {} - Domain hoarding made less painful
Mode :
--cli Default none interactive mode
--tui Easy to use Terminal based Graphical user interface
Basics :
-a --all Show all in list even when unavailable
-H --fullhelp Show full help
Example usage :
hoardom --tui Launch Terminal UI.
hoardom idea.com See if idea.com is available
hoardom -a idea1 idea2 See Table of available domains starting with that
",
env!("CARGO_PKG_VERSION")
);
}
pub fn print_fullhelp() {
println!(
"hoardom {} - they are inside your walls!
## if you see this send a fax to +41 43 543 04 47 that mentions hoardom to know your fate ##
Mode :
--cli Default none interactive mode
--tui Easy to use Terminal based Graphical user interface
Basics :
-a --all Show all in list even when unavailable
-c --csv=PATH Out in CSV, Path is optional
-l --list=LIST Built in TLD Lists are : {}
Advanced :
-e --environement=PATH Define where .hoardom folder should be
Defaults to /home/USER/.hoardom/
Stores settings, imported lists, favs, cache etc.
-i --import-filter=PATH Import a custom toml list for this session
-t --top=TLD,TLD Set certain TLDs to show up as first result
for when you need a domain in your country or for searching
a specific one.
(Unless changed after launch in TUI mode)
-o --onlytop=TLD,TLD Only search these TLDs
-s --suggestions=NUMBER How many suggestions to look up and try to show from list
Number of available alternativ domains to try and find when
Searching for full domain name directly.
Defaults to 0 (aka disabled)
Various :
-j --jobs=NUMBER Number of concurrent lookup requests
How many TLDs to look up at the same time (default: 32)
-D --delay=DELAY Set the global delay in Seconds between lookup requests
-R --retry=NUMBER Retry NUMBER amount of times if domain lookup errors out
-V --verbose Verbose output for debugging
-A --autosearch=FILE Search for names/domains in text file one domain per new line
-C --no-color Use a monochrome color scheme
-U --no-unicode Do not use unicode only plain ASCII
-M --no-mouse Disable the mouse integration for TUI
-r --refresh-cache Force refresh the RDAP bootstrap cache
Help :
-h --help Basic Help
-H --fullhelp You just did this",
env!("CARGO_PKG_VERSION"),
crate::tlds::list_names().join(", ")
);
}
|