tangled
alpha
login
or
join now
eldridge.cam
/
paper-terminal
0
fork
atom
Print Markdown to a paper in your terminal
0
fork
atom
overview
issues
pulls
pipelines
update to clap
eldridge.cam
2 years ago
8dbafae4
9dc77081
+188
-110
3 changed files
expand all
collapse all
unified
split
Cargo.lock
Cargo.toml
src
main.rs
+171
-92
Cargo.lock
···
33
]
34
35
[[package]]
36
-
name = "atty"
37
-
version = "0.2.14"
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
38
source = "registry+https://github.com/rust-lang/crates.io-index"
39
-
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
40
dependencies = [
41
-
"hermit-abi",
42
-
"libc",
43
-
"winapi",
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
44
]
45
46
[[package]]
···
93
94
[[package]]
95
name = "clap"
96
-
version = "2.34.0"
0
0
0
0
0
0
0
0
0
0
97
source = "registry+https://github.com/rust-lang/crates.io-index"
98
-
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
99
dependencies = [
100
-
"ansi_term",
101
-
"atty",
102
-
"bitflags",
103
"strsim",
104
-
"textwrap",
105
-
"unicode-width",
106
-
"vec_map",
107
]
108
109
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
110
name = "color_quant"
111
version = "1.1.0"
112
source = "registry+https://github.com/rust-lang/crates.io-index"
113
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
0
0
0
0
0
0
114
115
[[package]]
116
name = "console"
···
265
266
[[package]]
267
name = "heck"
268
-
version = "0.3.3"
269
source = "registry+https://github.com/rust-lang/crates.io-index"
270
-
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
271
-
dependencies = [
272
-
"unicode-segmentation",
273
-
]
274
275
[[package]]
276
name = "hermit-abi"
···
424
dependencies = [
425
"ansi_term",
426
"cjk",
0
427
"console",
428
"directories-next",
429
"image",
430
"pulldown-cmark",
431
-
"structopt",
432
"syncat-stylesheet",
433
"terminal_size",
434
"unicode-width",
···
447
]
448
449
[[package]]
450
-
name = "proc-macro-error"
451
-
version = "1.0.4"
452
-
source = "registry+https://github.com/rust-lang/crates.io-index"
453
-
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
454
-
dependencies = [
455
-
"proc-macro-error-attr",
456
-
"proc-macro2",
457
-
"quote",
458
-
"syn",
459
-
"version_check",
460
-
]
461
-
462
-
[[package]]
463
-
name = "proc-macro-error-attr"
464
-
version = "1.0.4"
465
-
source = "registry+https://github.com/rust-lang/crates.io-index"
466
-
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
467
-
dependencies = [
468
-
"proc-macro2",
469
-
"quote",
470
-
"version_check",
471
-
]
472
-
473
-
[[package]]
474
name = "proc-macro2"
475
-
version = "1.0.40"
476
source = "registry+https://github.com/rust-lang/crates.io-index"
477
-
checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7"
478
dependencies = [
479
"unicode-ident",
480
]
···
493
494
[[package]]
495
name = "quote"
496
-
version = "1.0.20"
497
source = "registry+https://github.com/rust-lang/crates.io-index"
498
-
checksum = "3bcdf212e9776fbcb2d23ab029360416bb1706b1aea2d1a5ba002727cbcab804"
499
dependencies = [
500
"proc-macro2",
501
]
···
575
576
[[package]]
577
name = "strsim"
578
-
version = "0.8.0"
579
-
source = "registry+https://github.com/rust-lang/crates.io-index"
580
-
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
581
-
582
-
[[package]]
583
-
name = "structopt"
584
-
version = "0.3.26"
585
source = "registry+https://github.com/rust-lang/crates.io-index"
586
-
checksum = "0c6b5c64445ba8094a6ab0c3cd2ad323e07171012d9c98b0b15651daf1787a10"
587
-
dependencies = [
588
-
"clap",
589
-
"lazy_static",
590
-
"structopt-derive",
591
-
]
592
593
[[package]]
594
-
name = "structopt-derive"
595
-
version = "0.4.18"
596
source = "registry+https://github.com/rust-lang/crates.io-index"
597
-
checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0"
598
dependencies = [
599
-
"heck",
600
-
"proc-macro-error",
601
"proc-macro2",
602
"quote",
603
-
"syn",
604
]
605
606
[[package]]
607
name = "syn"
608
-
version = "1.0.98"
609
source = "registry+https://github.com/rust-lang/crates.io-index"
610
-
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
611
dependencies = [
612
"proc-macro2",
613
"quote",
···
616
617
[[package]]
618
name = "syncat-stylesheet"
619
-
version = "2.2.1"
620
source = "registry+https://github.com/rust-lang/crates.io-index"
621
-
checksum = "2abdfdde201305d60c7f184dde404f6cae02390dda149567b7fca39fe76c21d4"
622
dependencies = [
623
"ansi_term",
624
"cc",
···
639
]
640
641
[[package]]
642
-
name = "textwrap"
643
-
version = "0.11.0"
644
-
source = "registry+https://github.com/rust-lang/crates.io-index"
645
-
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
646
-
dependencies = [
647
-
"unicode-width",
648
-
]
649
-
650
-
[[package]]
651
name = "thiserror"
652
version = "1.0.31"
653
source = "registry+https://github.com/rust-lang/crates.io-index"
···
664
dependencies = [
665
"proc-macro2",
666
"quote",
667
-
"syn",
668
]
669
670
[[package]]
···
680
681
[[package]]
682
name = "tree-sitter"
683
-
version = "0.19.5"
684
source = "registry+https://github.com/rust-lang/crates.io-index"
685
-
checksum = "ad726ec26496bf4c083fff0f43d4eb3a2ad1bba305323af5ff91383c0b6ecac0"
686
dependencies = [
687
"cc",
688
"regex",
···
710
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
711
712
[[package]]
713
-
name = "unicode-segmentation"
714
-
version = "1.9.0"
715
-
source = "registry+https://github.com/rust-lang/crates.io-index"
716
-
checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99"
717
-
718
-
[[package]]
719
name = "unicode-width"
720
version = "0.1.9"
721
source = "registry+https://github.com/rust-lang/crates.io-index"
722
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
723
724
[[package]]
725
-
name = "vec_map"
726
-
version = "0.8.2"
727
source = "registry+https://github.com/rust-lang/crates.io-index"
728
-
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
729
730
[[package]]
731
name = "version_check"
···
772
version = "0.4.0"
773
source = "registry+https://github.com/rust-lang/crates.io-index"
774
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
33
]
34
35
[[package]]
36
+
name = "anstream"
37
+
version = "0.6.4"
38
+
source = "registry+https://github.com/rust-lang/crates.io-index"
39
+
checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44"
40
+
dependencies = [
41
+
"anstyle",
42
+
"anstyle-parse",
43
+
"anstyle-query",
44
+
"anstyle-wincon",
45
+
"colorchoice",
46
+
"utf8parse",
47
+
]
48
+
49
+
[[package]]
50
+
name = "anstyle"
51
+
version = "1.0.4"
52
+
source = "registry+https://github.com/rust-lang/crates.io-index"
53
+
checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87"
54
+
55
+
[[package]]
56
+
name = "anstyle-parse"
57
+
version = "0.2.2"
58
source = "registry+https://github.com/rust-lang/crates.io-index"
59
+
checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140"
60
dependencies = [
61
+
"utf8parse",
62
+
]
63
+
64
+
[[package]]
65
+
name = "anstyle-query"
66
+
version = "1.0.0"
67
+
source = "registry+https://github.com/rust-lang/crates.io-index"
68
+
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
69
+
dependencies = [
70
+
"windows-sys",
71
+
]
72
+
73
+
[[package]]
74
+
name = "anstyle-wincon"
75
+
version = "3.0.1"
76
+
source = "registry+https://github.com/rust-lang/crates.io-index"
77
+
checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628"
78
+
dependencies = [
79
+
"anstyle",
80
+
"windows-sys",
81
]
82
83
[[package]]
···
130
131
[[package]]
132
name = "clap"
133
+
version = "4.4.8"
134
+
source = "registry+https://github.com/rust-lang/crates.io-index"
135
+
checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64"
136
+
dependencies = [
137
+
"clap_builder",
138
+
"clap_derive",
139
+
]
140
+
141
+
[[package]]
142
+
name = "clap_builder"
143
+
version = "4.4.8"
144
source = "registry+https://github.com/rust-lang/crates.io-index"
145
+
checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc"
146
dependencies = [
147
+
"anstream",
148
+
"anstyle",
149
+
"clap_lex",
150
"strsim",
0
0
0
151
]
152
153
[[package]]
154
+
name = "clap_derive"
155
+
version = "4.4.7"
156
+
source = "registry+https://github.com/rust-lang/crates.io-index"
157
+
checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442"
158
+
dependencies = [
159
+
"heck",
160
+
"proc-macro2",
161
+
"quote",
162
+
"syn 2.0.39",
163
+
]
164
+
165
+
[[package]]
166
+
name = "clap_lex"
167
+
version = "0.6.0"
168
+
source = "registry+https://github.com/rust-lang/crates.io-index"
169
+
checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
170
+
171
+
[[package]]
172
name = "color_quant"
173
version = "1.1.0"
174
source = "registry+https://github.com/rust-lang/crates.io-index"
175
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
176
+
177
+
[[package]]
178
+
name = "colorchoice"
179
+
version = "1.0.0"
180
+
source = "registry+https://github.com/rust-lang/crates.io-index"
181
+
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
182
183
[[package]]
184
name = "console"
···
333
334
[[package]]
335
name = "heck"
336
+
version = "0.4.1"
337
source = "registry+https://github.com/rust-lang/crates.io-index"
338
+
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
0
0
0
339
340
[[package]]
341
name = "hermit-abi"
···
489
dependencies = [
490
"ansi_term",
491
"cjk",
492
+
"clap",
493
"console",
494
"directories-next",
495
"image",
496
"pulldown-cmark",
0
497
"syncat-stylesheet",
498
"terminal_size",
499
"unicode-width",
···
512
]
513
514
[[package]]
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
515
name = "proc-macro2"
516
+
version = "1.0.69"
517
source = "registry+https://github.com/rust-lang/crates.io-index"
518
+
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
519
dependencies = [
520
"unicode-ident",
521
]
···
534
535
[[package]]
536
name = "quote"
537
+
version = "1.0.33"
538
source = "registry+https://github.com/rust-lang/crates.io-index"
539
+
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
540
dependencies = [
541
"proc-macro2",
542
]
···
616
617
[[package]]
618
name = "strsim"
619
+
version = "0.10.0"
0
0
0
0
0
0
620
source = "registry+https://github.com/rust-lang/crates.io-index"
621
+
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
0
0
0
0
0
622
623
[[package]]
624
+
name = "syn"
625
+
version = "1.0.98"
626
source = "registry+https://github.com/rust-lang/crates.io-index"
627
+
checksum = "c50aef8a904de4c23c788f104b7dddc7d6f79c647c7c8ce4cc8f73eb0ca773dd"
628
dependencies = [
0
0
629
"proc-macro2",
630
"quote",
631
+
"unicode-ident",
632
]
633
634
[[package]]
635
name = "syn"
636
+
version = "2.0.39"
637
source = "registry+https://github.com/rust-lang/crates.io-index"
638
+
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
639
dependencies = [
640
"proc-macro2",
641
"quote",
···
644
645
[[package]]
646
name = "syncat-stylesheet"
647
+
version = "3.5.0"
648
source = "registry+https://github.com/rust-lang/crates.io-index"
649
+
checksum = "9a0ad46e0dea7c8a1affa928824a3eaf1e24812fb9f91921b00eb2587c63ef29"
650
dependencies = [
651
"ansi_term",
652
"cc",
···
667
]
668
669
[[package]]
0
0
0
0
0
0
0
0
0
670
name = "thiserror"
671
version = "1.0.31"
672
source = "registry+https://github.com/rust-lang/crates.io-index"
···
683
dependencies = [
684
"proc-macro2",
685
"quote",
686
+
"syn 1.0.98",
687
]
688
689
[[package]]
···
699
700
[[package]]
701
name = "tree-sitter"
702
+
version = "0.20.10"
703
source = "registry+https://github.com/rust-lang/crates.io-index"
704
+
checksum = "e747b1f9b7b931ed39a548c1fae149101497de3c1fc8d9e18c62c1a66c683d3d"
705
dependencies = [
706
"cc",
707
"regex",
···
729
checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c"
730
731
[[package]]
0
0
0
0
0
0
732
name = "unicode-width"
733
version = "0.1.9"
734
source = "registry+https://github.com/rust-lang/crates.io-index"
735
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
736
737
[[package]]
738
+
name = "utf8parse"
739
+
version = "0.2.1"
740
source = "registry+https://github.com/rust-lang/crates.io-index"
741
+
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
742
743
[[package]]
744
name = "version_check"
···
785
version = "0.4.0"
786
source = "registry+https://github.com/rust-lang/crates.io-index"
787
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
788
+
789
+
[[package]]
790
+
name = "windows-sys"
791
+
version = "0.48.0"
792
+
source = "registry+https://github.com/rust-lang/crates.io-index"
793
+
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
794
+
dependencies = [
795
+
"windows-targets",
796
+
]
797
+
798
+
[[package]]
799
+
name = "windows-targets"
800
+
version = "0.48.5"
801
+
source = "registry+https://github.com/rust-lang/crates.io-index"
802
+
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
803
+
dependencies = [
804
+
"windows_aarch64_gnullvm",
805
+
"windows_aarch64_msvc",
806
+
"windows_i686_gnu",
807
+
"windows_i686_msvc",
808
+
"windows_x86_64_gnu",
809
+
"windows_x86_64_gnullvm",
810
+
"windows_x86_64_msvc",
811
+
]
812
+
813
+
[[package]]
814
+
name = "windows_aarch64_gnullvm"
815
+
version = "0.48.5"
816
+
source = "registry+https://github.com/rust-lang/crates.io-index"
817
+
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
818
+
819
+
[[package]]
820
+
name = "windows_aarch64_msvc"
821
+
version = "0.48.5"
822
+
source = "registry+https://github.com/rust-lang/crates.io-index"
823
+
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
824
+
825
+
[[package]]
826
+
name = "windows_i686_gnu"
827
+
version = "0.48.5"
828
+
source = "registry+https://github.com/rust-lang/crates.io-index"
829
+
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
830
+
831
+
[[package]]
832
+
name = "windows_i686_msvc"
833
+
version = "0.48.5"
834
+
source = "registry+https://github.com/rust-lang/crates.io-index"
835
+
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
836
+
837
+
[[package]]
838
+
name = "windows_x86_64_gnu"
839
+
version = "0.48.5"
840
+
source = "registry+https://github.com/rust-lang/crates.io-index"
841
+
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
842
+
843
+
[[package]]
844
+
name = "windows_x86_64_gnullvm"
845
+
version = "0.48.5"
846
+
source = "registry+https://github.com/rust-lang/crates.io-index"
847
+
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
848
+
849
+
[[package]]
850
+
name = "windows_x86_64_msvc"
851
+
version = "0.48.5"
852
+
source = "registry+https://github.com/rust-lang/crates.io-index"
853
+
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+2
-2
Cargo.toml
···
17
path = "src/main.rs"
18
19
[dependencies]
20
-
structopt = "0.3"
21
terminal_size = "0.1"
22
pulldown-cmark = "0.8"
23
ansi_term = "0.12"
24
image = "0.23"
25
console = { version = "0.14", features = ["unicode-width"] }
26
directories-next = "2.0"
27
-
syncat-stylesheet = { version = "2.1.4", features = ["ansi_term"] }
28
unicode-width = "0.1"
29
cjk = "0.2"
···
17
path = "src/main.rs"
18
19
[dependencies]
20
+
clap = { version = "4.4", features = ["derive"] }
21
terminal_size = "0.1"
22
pulldown-cmark = "0.8"
23
ansi_term = "0.12"
24
image = "0.23"
25
console = { version = "0.14", features = ["unicode-width"] }
26
directories-next = "2.0"
27
+
syncat-stylesheet = { version = "3.5.0", features = ["ansi_term"] }
28
unicode-width = "0.1"
29
cjk = "0.2"
+15
-16
src/main.rs
···
1
use ansi_term::Style;
0
2
use console::strip_ansi_codes;
3
use pulldown_cmark::{Options, Parser};
4
use std::convert::TryInto;
5
use std::fs;
6
use std::io::{self, Read};
7
use std::path::PathBuf;
8
-
use structopt::StructOpt;
9
use syncat_stylesheet::Stylesheet;
10
use terminal_size::{terminal_size, Width};
11
···
21
use words::Words;
22
23
/// Prints papers in your terminal
24
-
#[derive(StructOpt, Debug)]
25
-
#[structopt(name = "paper")]
26
-
#[structopt(rename_all = "kebab-case")]
27
-
#[structopt(setting = structopt::clap::AppSettings::ColoredHelp)]
28
pub struct Opts {
29
/// Margin (shortcut for horizontal and vertical margin set to the same value)
30
-
#[structopt(short, long, default_value = "6")]
31
pub margin: usize,
32
33
/// Horizontal margin (overrides --margin)
34
-
#[structopt(short, long)]
35
pub h_margin: Option<usize>,
36
37
/// Vertical margin (overrides --margin)
38
-
#[structopt(short, long)]
39
pub v_margin: Option<usize>,
40
41
/// The width of the paper (including the space used for the margin)
42
-
#[structopt(short, long, default_value = "92")]
43
pub width: usize,
44
45
/// Don't parse as Markdown, just render the plain text on a paper
46
-
#[structopt(short, long)]
47
pub plain: bool,
48
49
/// The length to consider tabs as.
···
51
pub tab_length: usize,
52
53
/// Hide link URLs
54
-
#[structopt(short = "u", long)]
55
pub hide_urls: bool,
56
57
/// Disable drawing images
58
-
#[structopt(short = "i", long)]
59
pub no_images: bool,
60
61
/// Position paper on the left edge of the terminal, instead of centred.
62
-
#[structopt(short = "l", long)]
63
pub left: bool,
64
65
/// Position paper on the right edge of the terminal, instead of centred.
66
-
#[structopt(short = "r", long)]
67
pub right: bool,
68
69
/// Use syncat to highlight code blocks. Requires you have syncat installed.
···
75
pub dev: bool,
76
77
/// Files to print
78
-
#[structopt(name = "FILE", parse(from_os_str))]
79
pub files: Vec<PathBuf>,
80
}
81
···
235
}
236
237
fn main() {
238
-
let opts = Opts::from_args();
239
240
if opts.files.is_empty() {
241
let mut string = String::new();
···
1
use ansi_term::Style;
2
+
use clap::Parser as _;
3
use console::strip_ansi_codes;
4
use pulldown_cmark::{Options, Parser};
5
use std::convert::TryInto;
6
use std::fs;
7
use std::io::{self, Read};
8
use std::path::PathBuf;
0
9
use syncat_stylesheet::Stylesheet;
10
use terminal_size::{terminal_size, Width};
11
···
21
use words::Words;
22
23
/// Prints papers in your terminal
24
+
#[derive(clap::Parser, Debug)]
25
+
#[clap(name = "paper")]
26
+
#[clap(rename_all = "kebab-case")]
0
27
pub struct Opts {
28
/// Margin (shortcut for horizontal and vertical margin set to the same value)
29
+
#[structopt(short = 'm', long, default_value = "6")]
30
pub margin: usize,
31
32
/// Horizontal margin (overrides --margin)
33
+
#[structopt(long)]
34
pub h_margin: Option<usize>,
35
36
/// Vertical margin (overrides --margin)
37
+
#[structopt(long)]
38
pub v_margin: Option<usize>,
39
40
/// The width of the paper (including the space used for the margin)
41
+
#[structopt(short = 'w', long, default_value = "92")]
42
pub width: usize,
43
44
/// Don't parse as Markdown, just render the plain text on a paper
45
+
#[structopt(short = 'p', long)]
46
pub plain: bool,
47
48
/// The length to consider tabs as.
···
50
pub tab_length: usize,
51
52
/// Hide link URLs
53
+
#[structopt(short = 'U', long)]
54
pub hide_urls: bool,
55
56
/// Disable drawing images
57
+
#[structopt(short = 'I', long)]
58
pub no_images: bool,
59
60
/// Position paper on the left edge of the terminal, instead of centred.
61
+
#[structopt(short = 'l', long)]
62
pub left: bool,
63
64
/// Position paper on the right edge of the terminal, instead of centred.
65
+
#[structopt(short = 'r', long)]
66
pub right: bool,
67
68
/// Use syncat to highlight code blocks. Requires you have syncat installed.
···
74
pub dev: bool,
75
76
/// Files to print
77
+
#[structopt(name = "FILE")]
78
pub files: Vec<PathBuf>,
79
}
80
···
234
}
235
236
fn main() {
237
+
let opts = Opts::parse();
238
239
if opts.files.is_empty() {
240
let mut string = String::new();