Print the ArchiveBox help message and usage
(out_dir: Path=OUTPUT_DIR)
| 145 | |
| 146 | @enforce_types |
| 147 | def help(out_dir: Path=OUTPUT_DIR) -> None: |
| 148 | """Print the ArchiveBox help message and usage""" |
| 149 | |
| 150 | all_subcommands = list_subcommands() |
| 151 | COMMANDS_HELP_TEXT = '\n '.join( |
| 152 | f'{cmd.ljust(20)} {summary}' |
| 153 | for cmd, summary in all_subcommands.items() |
| 154 | if cmd in meta_cmds |
| 155 | ) + '\n\n ' + '\n '.join( |
| 156 | f'{cmd.ljust(20)} {summary}' |
| 157 | for cmd, summary in all_subcommands.items() |
| 158 | if cmd in main_cmds |
| 159 | ) + '\n\n ' + '\n '.join( |
| 160 | f'{cmd.ljust(20)} {summary}' |
| 161 | for cmd, summary in all_subcommands.items() |
| 162 | if cmd in archive_cmds |
| 163 | ) + '\n\n ' + '\n '.join( |
| 164 | f'{cmd.ljust(20)} {summary}' |
| 165 | for cmd, summary in all_subcommands.items() |
| 166 | if cmd not in display_first |
| 167 | ) |
| 168 | |
| 169 | |
| 170 | if (Path(out_dir) / SQL_INDEX_FILENAME).exists(): |
| 171 | print('''{green}ArchiveBox v{}: The self-hosted internet archive.{reset} |
| 172 | |
| 173 | {lightred}Active data directory:{reset} |
| 174 | {} |
| 175 | |
| 176 | {lightred}Usage:{reset} |
| 177 | archivebox [command] [--help] [--version] [...args] |
| 178 | |
| 179 | {lightred}Commands:{reset} |
| 180 | {} |
| 181 | |
| 182 | {lightred}Example Use:{reset} |
| 183 | mkdir my-archive; cd my-archive/ |
| 184 | archivebox init |
| 185 | archivebox status |
| 186 | |
| 187 | archivebox add https://example.com/some/page |
| 188 | archivebox add --depth=1 ~/Downloads/bookmarks_export.html |
| 189 | |
| 190 | archivebox list --sort=timestamp --csv=timestamp,url,is_archived |
| 191 | archivebox schedule --every=day https://example.com/some/feed.rss |
| 192 | archivebox update --resume=15109948213.123 |
| 193 | |
| 194 | {lightred}Documentation:{reset} |
| 195 | https://github.com/ArchiveBox/ArchiveBox/wiki |
| 196 | '''.format(VERSION, out_dir, COMMANDS_HELP_TEXT, **ANSI)) |
| 197 | |
| 198 | else: |
| 199 | print('{green}Welcome to ArchiveBox v{}!{reset}'.format(VERSION, **ANSI)) |
| 200 | print() |
| 201 | if IN_DOCKER: |
| 202 | print('When using Docker, you need to mount a volume to use as your data dir:') |
| 203 | print(' docker run -v /some/path:/data archivebox ...') |
| 204 | print() |
no test coverage detected