diff options
author | Akshay <[email protected]> | 2020-08-04 07:47:09 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2020-08-04 07:47:09 +0100 |
commit | 403d114d8296fe37dbdb509449a2fee2badb8d37 (patch) | |
tree | 05bb0d1cc7aced39fed3049c30221e30281698c4 | |
parent | 807f945a08e0ff28968194c098a0a05a6a79ba09 (diff) |
add feature to compile on windows, switch to termion
-rw-r--r-- | .github/workflows/main.yml | 2 | ||||
-rw-r--r-- | Cargo.lock | 190 | ||||
-rw-r--r-- | Cargo.toml | 6 | ||||
-rw-r--r-- | src/main.rs | 14 |
4 files changed, 153 insertions, 59 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c07d9b..8786029 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml | |||
@@ -106,7 +106,7 @@ jobs: | |||
106 | 106 | ||
107 | - name: Build for windows | 107 | - name: Build for windows |
108 | shell: bash | 108 | shell: bash |
109 | run: cargo build --release | 109 | run: cargo build --release --no-default-features --features "crossterm-backend" |
110 | 110 | ||
111 | - name: Upload binaries to release | 111 | - name: Upload binaries to release |
112 | uses: svenstaro/upload-release-action@v1-release | 112 | uses: svenstaro/upload-release-action@v1-release |
@@ -92,12 +92,6 @@ dependencies = [ | |||
92 | ] | 92 | ] |
93 | 93 | ||
94 | [[package]] | 94 | [[package]] |
95 | name = "cc" | ||
96 | version = "1.0.58" | ||
97 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
98 | checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" | ||
99 | |||
100 | [[package]] | ||
101 | name = "cfg-if" | 95 | name = "cfg-if" |
102 | version = "0.1.10" | 96 | version = "0.1.10" |
103 | source = "registry+https://github.com/rust-lang/crates.io-index" | 97 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -131,6 +125,15 @@ dependencies = [ | |||
131 | ] | 125 | ] |
132 | 126 | ||
133 | [[package]] | 127 | [[package]] |
128 | name = "cloudabi" | ||
129 | version = "0.0.3" | ||
130 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
131 | checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" | ||
132 | dependencies = [ | ||
133 | "bitflags", | ||
134 | ] | ||
135 | |||
136 | [[package]] | ||
134 | name = "const-random" | 137 | name = "const-random" |
135 | version = "0.1.8" | 138 | version = "0.1.8" |
136 | source = "registry+https://github.com/rust-lang/crates.io-index" | 139 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -178,6 +181,31 @@ dependencies = [ | |||
178 | ] | 181 | ] |
179 | 182 | ||
180 | [[package]] | 183 | [[package]] |
184 | name = "crossterm" | ||
185 | version = "0.17.7" | ||
186 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
187 | checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7" | ||
188 | dependencies = [ | ||
189 | "bitflags", | ||
190 | "crossterm_winapi", | ||
191 | "lazy_static", | ||
192 | "libc", | ||
193 | "mio 0.7.0", | ||
194 | "parking_lot", | ||
195 | "signal-hook", | ||
196 | "winapi 0.3.9", | ||
197 | ] | ||
198 | |||
199 | [[package]] | ||
200 | name = "crossterm_winapi" | ||
201 | version = "0.6.1" | ||
202 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
203 | checksum = "057b7146d02fb50175fd7dbe5158f6097f33d02831f43b4ee8ae4ddf67b68f5c" | ||
204 | dependencies = [ | ||
205 | "winapi 0.3.9", | ||
206 | ] | ||
207 | |||
208 | [[package]] | ||
181 | name = "ctor" | 209 | name = "ctor" |
182 | version = "0.1.15" | 210 | version = "0.1.15" |
183 | source = "registry+https://github.com/rust-lang/crates.io-index" | 211 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -196,15 +224,14 @@ dependencies = [ | |||
196 | "ahash 0.3.8", | 224 | "ahash 0.3.8", |
197 | "cfg-if", | 225 | "cfg-if", |
198 | "crossbeam-channel", | 226 | "crossbeam-channel", |
227 | "crossterm", | ||
199 | "cursive_core", | 228 | "cursive_core", |
200 | "enumset", | 229 | "enumset", |
201 | "lazy_static", | 230 | "lazy_static", |
202 | "libc", | 231 | "libc", |
203 | "log", | 232 | "log", |
204 | "maplit", | ||
205 | "pancurses", | ||
206 | "signal-hook", | 233 | "signal-hook", |
207 | "term_size", | 234 | "termion", |
208 | "unicode-segmentation", | 235 | "unicode-segmentation", |
209 | "unicode-width", | 236 | "unicode-width", |
210 | ] | 237 | ] |
@@ -531,6 +558,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
531 | checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" | 558 | checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" |
532 | 559 | ||
533 | [[package]] | 560 | [[package]] |
561 | name = "lock_api" | ||
562 | version = "0.3.4" | ||
563 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
564 | checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" | ||
565 | dependencies = [ | ||
566 | "scopeguard", | ||
567 | ] | ||
568 | |||
569 | [[package]] | ||
534 | name = "log" | 570 | name = "log" |
535 | version = "0.4.11" | 571 | version = "0.4.11" |
536 | source = "registry+https://github.com/rust-lang/crates.io-index" | 572 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -540,12 +576,6 @@ dependencies = [ | |||
540 | ] | 576 | ] |
541 | 577 | ||
542 | [[package]] | 578 | [[package]] |
543 | name = "maplit" | ||
544 | version = "1.0.2" | ||
545 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
546 | checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" | ||
547 | |||
548 | [[package]] | ||
549 | name = "mio" | 579 | name = "mio" |
550 | version = "0.6.22" | 580 | version = "0.6.22" |
551 | source = "registry+https://github.com/rust-lang/crates.io-index" | 581 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -558,13 +588,27 @@ dependencies = [ | |||
558 | "kernel32-sys", | 588 | "kernel32-sys", |
559 | "libc", | 589 | "libc", |
560 | "log", | 590 | "log", |
561 | "miow", | 591 | "miow 0.2.1", |
562 | "net2", | 592 | "net2", |
563 | "slab", | 593 | "slab", |
564 | "winapi 0.2.8", | 594 | "winapi 0.2.8", |
565 | ] | 595 | ] |
566 | 596 | ||
567 | [[package]] | 597 | [[package]] |
598 | name = "mio" | ||
599 | version = "0.7.0" | ||
600 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
601 | checksum = "6e9971bc8349a361217a8f2a41f5d011274686bd4436465ba51730921039d7fb" | ||
602 | dependencies = [ | ||
603 | "lazy_static", | ||
604 | "libc", | ||
605 | "log", | ||
606 | "miow 0.3.5", | ||
607 | "ntapi", | ||
608 | "winapi 0.3.9", | ||
609 | ] | ||
610 | |||
611 | [[package]] | ||
568 | name = "mio-extras" | 612 | name = "mio-extras" |
569 | version = "2.0.6" | 613 | version = "2.0.6" |
570 | source = "registry+https://github.com/rust-lang/crates.io-index" | 614 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -572,7 +616,7 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19" | |||
572 | dependencies = [ | 616 | dependencies = [ |
573 | "lazycell", | 617 | "lazycell", |
574 | "log", | 618 | "log", |
575 | "mio", | 619 | "mio 0.6.22", |
576 | "slab", | 620 | "slab", |
577 | ] | 621 | ] |
578 | 622 | ||
@@ -589,14 +633,13 @@ dependencies = [ | |||
589 | ] | 633 | ] |
590 | 634 | ||
591 | [[package]] | 635 | [[package]] |
592 | name = "ncurses" | 636 | name = "miow" |
593 | version = "5.99.0" | 637 | version = "0.3.5" |
594 | source = "registry+https://github.com/rust-lang/crates.io-index" | 638 | source = "registry+https://github.com/rust-lang/crates.io-index" |
595 | checksum = "15699bee2f37e9f8828c7b35b2bc70d13846db453f2d507713b758fabe536b82" | 639 | checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" |
596 | dependencies = [ | 640 | dependencies = [ |
597 | "cc", | 641 | "socket2", |
598 | "libc", | 642 | "winapi 0.3.9", |
599 | "pkg-config", | ||
600 | ] | 643 | ] |
601 | 644 | ||
602 | [[package]] | 645 | [[package]] |
@@ -622,13 +665,22 @@ dependencies = [ | |||
622 | "fsevent-sys", | 665 | "fsevent-sys", |
623 | "inotify", | 666 | "inotify", |
624 | "libc", | 667 | "libc", |
625 | "mio", | 668 | "mio 0.6.22", |
626 | "mio-extras", | 669 | "mio-extras", |
627 | "walkdir", | 670 | "walkdir", |
628 | "winapi 0.3.9", | 671 | "winapi 0.3.9", |
629 | ] | 672 | ] |
630 | 673 | ||
631 | [[package]] | 674 | [[package]] |
675 | name = "ntapi" | ||
676 | version = "0.3.4" | ||
677 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
678 | checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2" | ||
679 | dependencies = [ | ||
680 | "winapi 0.3.9", | ||
681 | ] | ||
682 | |||
683 | [[package]] | ||
632 | name = "num" | 684 | name = "num" |
633 | version = "0.3.0" | 685 | version = "0.3.0" |
634 | source = "registry+https://github.com/rust-lang/crates.io-index" | 686 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -692,6 +744,12 @@ dependencies = [ | |||
692 | ] | 744 | ] |
693 | 745 | ||
694 | [[package]] | 746 | [[package]] |
747 | name = "numtoa" | ||
748 | version = "0.1.0" | ||
749 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
750 | checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" | ||
751 | |||
752 | [[package]] | ||
695 | name = "owning_ref" | 753 | name = "owning_ref" |
696 | version = "0.4.1" | 754 | version = "0.4.1" |
697 | source = "registry+https://github.com/rust-lang/crates.io-index" | 755 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -701,35 +759,30 @@ dependencies = [ | |||
701 | ] | 759 | ] |
702 | 760 | ||
703 | [[package]] | 761 | [[package]] |
704 | name = "pancurses" | 762 | name = "parking_lot" |
705 | version = "0.16.1" | 763 | version = "0.10.2" |
706 | source = "registry+https://github.com/rust-lang/crates.io-index" | 764 | source = "registry+https://github.com/rust-lang/crates.io-index" |
707 | checksum = "d3058bc37c433096b2ac7afef1c5cdfae49ede0a4ffec3dfc1df1df0959d0ff0" | 765 | checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" |
708 | dependencies = [ | 766 | dependencies = [ |
709 | "libc", | 767 | "lock_api", |
710 | "log", | 768 | "parking_lot_core", |
711 | "ncurses", | ||
712 | "pdcurses-sys", | ||
713 | "winreg", | ||
714 | ] | 769 | ] |
715 | 770 | ||
716 | [[package]] | 771 | [[package]] |
717 | name = "pdcurses-sys" | 772 | name = "parking_lot_core" |
718 | version = "0.7.1" | 773 | version = "0.7.2" |
719 | source = "registry+https://github.com/rust-lang/crates.io-index" | 774 | source = "registry+https://github.com/rust-lang/crates.io-index" |
720 | checksum = "084dd22796ff60f1225d4eb6329f33afaf4c85419d51d440ab6b8c6f4529166b" | 775 | checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" |
721 | dependencies = [ | 776 | dependencies = [ |
722 | "cc", | 777 | "cfg-if", |
778 | "cloudabi", | ||
723 | "libc", | 779 | "libc", |
780 | "redox_syscall", | ||
781 | "smallvec", | ||
782 | "winapi 0.3.9", | ||
724 | ] | 783 | ] |
725 | 784 | ||
726 | [[package]] | 785 | [[package]] |
727 | name = "pkg-config" | ||
728 | version = "0.3.18" | ||
729 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
730 | checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" | ||
731 | |||
732 | [[package]] | ||
733 | name = "proc-macro-hack" | 786 | name = "proc-macro-hack" |
734 | version = "0.5.16" | 787 | version = "0.5.16" |
735 | source = "registry+https://github.com/rust-lang/crates.io-index" | 788 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -760,6 +813,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
760 | checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" | 813 | checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" |
761 | 814 | ||
762 | [[package]] | 815 | [[package]] |
816 | name = "redox_termios" | ||
817 | version = "0.1.1" | ||
818 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
819 | checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" | ||
820 | dependencies = [ | ||
821 | "redox_syscall", | ||
822 | ] | ||
823 | |||
824 | [[package]] | ||
763 | name = "redox_users" | 825 | name = "redox_users" |
764 | version = "0.3.4" | 826 | version = "0.3.4" |
765 | source = "registry+https://github.com/rust-lang/crates.io-index" | 827 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -798,6 +860,12 @@ dependencies = [ | |||
798 | ] | 860 | ] |
799 | 861 | ||
800 | [[package]] | 862 | [[package]] |
863 | name = "scopeguard" | ||
864 | version = "1.1.0" | ||
865 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
866 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" | ||
867 | |||
868 | [[package]] | ||
801 | name = "serde" | 869 | name = "serde" |
802 | version = "1.0.114" | 870 | version = "1.0.114" |
803 | source = "registry+https://github.com/rust-lang/crates.io-index" | 871 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -835,6 +903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
835 | checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed" | 903 | checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed" |
836 | dependencies = [ | 904 | dependencies = [ |
837 | "libc", | 905 | "libc", |
906 | "mio 0.7.0", | ||
838 | "signal-hook-registry", | 907 | "signal-hook-registry", |
839 | ] | 908 | ] |
840 | 909 | ||
@@ -855,6 +924,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
855 | checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" | 924 | checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" |
856 | 925 | ||
857 | [[package]] | 926 | [[package]] |
927 | name = "smallvec" | ||
928 | version = "1.4.1" | ||
929 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
930 | checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" | ||
931 | |||
932 | [[package]] | ||
933 | name = "socket2" | ||
934 | version = "0.3.12" | ||
935 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
936 | checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" | ||
937 | dependencies = [ | ||
938 | "cfg-if", | ||
939 | "libc", | ||
940 | "redox_syscall", | ||
941 | "winapi 0.3.9", | ||
942 | ] | ||
943 | |||
944 | [[package]] | ||
858 | name = "stable_deref_trait" | 945 | name = "stable_deref_trait" |
859 | version = "1.2.0" | 946 | version = "1.2.0" |
860 | source = "registry+https://github.com/rust-lang/crates.io-index" | 947 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -884,13 +971,15 @@ dependencies = [ | |||
884 | ] | 971 | ] |
885 | 972 | ||
886 | [[package]] | 973 | [[package]] |
887 | name = "term_size" | 974 | name = "termion" |
888 | version = "0.3.2" | 975 | version = "1.5.5" |
889 | source = "registry+https://github.com/rust-lang/crates.io-index" | 976 | source = "registry+https://github.com/rust-lang/crates.io-index" |
890 | checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" | 977 | checksum = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905" |
891 | dependencies = [ | 978 | dependencies = [ |
892 | "libc", | 979 | "libc", |
893 | "winapi 0.3.9", | 980 | "numtoa", |
981 | "redox_syscall", | ||
982 | "redox_termios", | ||
894 | ] | 983 | ] |
895 | 984 | ||
896 | [[package]] | 985 | [[package]] |
@@ -1030,15 +1119,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
1030 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | 1119 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" |
1031 | 1120 | ||
1032 | [[package]] | 1121 | [[package]] |
1033 | name = "winreg" | ||
1034 | version = "0.5.1" | ||
1035 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
1036 | checksum = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a" | ||
1037 | dependencies = [ | ||
1038 | "winapi 0.3.9", | ||
1039 | ] | ||
1040 | |||
1041 | [[package]] | ||
1042 | name = "ws2_32-sys" | 1122 | name = "ws2_32-sys" |
1043 | version = "0.2.1" | 1123 | version = "0.2.1" |
1044 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1124 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -24,7 +24,6 @@ toml = "0.5.6" | |||
24 | [dependencies.cursive] | 24 | [dependencies.cursive] |
25 | version = "0.15" | 25 | version = "0.15" |
26 | default-features = false | 26 | default-features = false |
27 | features = ["pancurses-backend"] | ||
28 | 27 | ||
29 | [dependencies.chrono] | 28 | [dependencies.chrono] |
30 | version = "0.4" | 29 | version = "0.4" |
@@ -33,3 +32,8 @@ features = ["serde"] | |||
33 | [dependencies.serde] | 32 | [dependencies.serde] |
34 | version = "1.0.103" | 33 | version = "1.0.103" |
35 | features = ["derive"] | 34 | features = ["derive"] |
35 | |||
36 | [features] | ||
37 | default = ["termion-backend"] | ||
38 | termion-backend = ["cursive/termion-backend"] | ||
39 | crossterm-backend = ["cursive/crossterm-backend"] | ||
diff --git a/src/main.rs b/src/main.rs index 84fd8ee..56c521d 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -12,7 +12,13 @@ use crate::command::{open_command_window, Command}; | |||
12 | use crate::utils::{load_configuration_file, AppConfig}; | 12 | use crate::utils::{load_configuration_file, AppConfig}; |
13 | 13 | ||
14 | use clap::{App as ClapApp, Arg}; | 14 | use clap::{App as ClapApp, Arg}; |
15 | use cursive::pancurses; | 15 | |
16 | #[cfg(any(feature = "termion-backend", feature = "default"))] | ||
17 | use cursive::termion; | ||
18 | |||
19 | #[cfg(feature = "crossterm-backend")] | ||
20 | use cursive::crossterm; | ||
21 | |||
16 | use cursive::views::{LinearLayout, NamedView}; | 22 | use cursive::views::{LinearLayout, NamedView}; |
17 | use lazy_static::lazy_static; | 23 | use lazy_static::lazy_static; |
18 | 24 | ||
@@ -62,7 +68,11 @@ fn main() { | |||
62 | println!("{}", h); | 68 | println!("{}", h); |
63 | } | 69 | } |
64 | } else { | 70 | } else { |
65 | let mut s = pancurses().unwrap(); | 71 | #[cfg(any(feature = "termion-backend", feature = "default"))] |
72 | let mut s = termion().unwrap(); | ||
73 | |||
74 | #[cfg(feature = "crossterm-backend")] | ||
75 | let mut s = crossterm().unwrap(); | ||
66 | 76 | ||
67 | let app = App::load_state(); | 77 | let app = App::load_state(); |
68 | let layout = NamedView::new( | 78 | let layout = NamedView::new( |