aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2020-08-04 07:47:09 +0100
committerAkshay <[email protected]>2020-08-04 07:47:09 +0100
commit403d114d8296fe37dbdb509449a2fee2badb8d37 (patch)
tree05bb0d1cc7aced39fed3049c30221e30281698c4
parent807f945a08e0ff28968194c098a0a05a6a79ba09 (diff)
add feature to compile on windows, switch to termion
-rw-r--r--.github/workflows/main.yml2
-rw-r--r--Cargo.lock190
-rw-r--r--Cargo.toml6
-rw-r--r--src/main.rs14
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
diff --git a/Cargo.lock b/Cargo.lock
index d53a14d..01fdb84 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -92,12 +92,6 @@ dependencies = [
92] 92]
93 93
94[[package]] 94[[package]]
95name = "cc"
96version = "1.0.58"
97source = "registry+https://github.com/rust-lang/crates.io-index"
98checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
99
100[[package]]
101name = "cfg-if" 95name = "cfg-if"
102version = "0.1.10" 96version = "0.1.10"
103source = "registry+https://github.com/rust-lang/crates.io-index" 97source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -131,6 +125,15 @@ dependencies = [
131] 125]
132 126
133[[package]] 127[[package]]
128name = "cloudabi"
129version = "0.0.3"
130source = "registry+https://github.com/rust-lang/crates.io-index"
131checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
132dependencies = [
133 "bitflags",
134]
135
136[[package]]
134name = "const-random" 137name = "const-random"
135version = "0.1.8" 138version = "0.1.8"
136source = "registry+https://github.com/rust-lang/crates.io-index" 139source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -178,6 +181,31 @@ dependencies = [
178] 181]
179 182
180[[package]] 183[[package]]
184name = "crossterm"
185version = "0.17.7"
186source = "registry+https://github.com/rust-lang/crates.io-index"
187checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7"
188dependencies = [
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]]
200name = "crossterm_winapi"
201version = "0.6.1"
202source = "registry+https://github.com/rust-lang/crates.io-index"
203checksum = "057b7146d02fb50175fd7dbe5158f6097f33d02831f43b4ee8ae4ddf67b68f5c"
204dependencies = [
205 "winapi 0.3.9",
206]
207
208[[package]]
181name = "ctor" 209name = "ctor"
182version = "0.1.15" 210version = "0.1.15"
183source = "registry+https://github.com/rust-lang/crates.io-index" 211source = "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"
531checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" 558checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
532 559
533[[package]] 560[[package]]
561name = "lock_api"
562version = "0.3.4"
563source = "registry+https://github.com/rust-lang/crates.io-index"
564checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
565dependencies = [
566 "scopeguard",
567]
568
569[[package]]
534name = "log" 570name = "log"
535version = "0.4.11" 571version = "0.4.11"
536source = "registry+https://github.com/rust-lang/crates.io-index" 572source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -540,12 +576,6 @@ dependencies = [
540] 576]
541 577
542[[package]] 578[[package]]
543name = "maplit"
544version = "1.0.2"
545source = "registry+https://github.com/rust-lang/crates.io-index"
546checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
547
548[[package]]
549name = "mio" 579name = "mio"
550version = "0.6.22" 580version = "0.6.22"
551source = "registry+https://github.com/rust-lang/crates.io-index" 581source = "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]]
598name = "mio"
599version = "0.7.0"
600source = "registry+https://github.com/rust-lang/crates.io-index"
601checksum = "6e9971bc8349a361217a8f2a41f5d011274686bd4436465ba51730921039d7fb"
602dependencies = [
603 "lazy_static",
604 "libc",
605 "log",
606 "miow 0.3.5",
607 "ntapi",
608 "winapi 0.3.9",
609]
610
611[[package]]
568name = "mio-extras" 612name = "mio-extras"
569version = "2.0.6" 613version = "2.0.6"
570source = "registry+https://github.com/rust-lang/crates.io-index" 614source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -572,7 +616,7 @@ checksum = "52403fe290012ce777c4626790c8951324a2b9e3316b3143779c72b029742f19"
572dependencies = [ 616dependencies = [
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]]
592name = "ncurses" 636name = "miow"
593version = "5.99.0" 637version = "0.3.5"
594source = "registry+https://github.com/rust-lang/crates.io-index" 638source = "registry+https://github.com/rust-lang/crates.io-index"
595checksum = "15699bee2f37e9f8828c7b35b2bc70d13846db453f2d507713b758fabe536b82" 639checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
596dependencies = [ 640dependencies = [
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]]
675name = "ntapi"
676version = "0.3.4"
677source = "registry+https://github.com/rust-lang/crates.io-index"
678checksum = "7a31937dea023539c72ddae0e3571deadc1414b300483fa7aaec176168cfa9d2"
679dependencies = [
680 "winapi 0.3.9",
681]
682
683[[package]]
632name = "num" 684name = "num"
633version = "0.3.0" 685version = "0.3.0"
634source = "registry+https://github.com/rust-lang/crates.io-index" 686source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -692,6 +744,12 @@ dependencies = [
692] 744]
693 745
694[[package]] 746[[package]]
747name = "numtoa"
748version = "0.1.0"
749source = "registry+https://github.com/rust-lang/crates.io-index"
750checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
751
752[[package]]
695name = "owning_ref" 753name = "owning_ref"
696version = "0.4.1" 754version = "0.4.1"
697source = "registry+https://github.com/rust-lang/crates.io-index" 755source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -701,35 +759,30 @@ dependencies = [
701] 759]
702 760
703[[package]] 761[[package]]
704name = "pancurses" 762name = "parking_lot"
705version = "0.16.1" 763version = "0.10.2"
706source = "registry+https://github.com/rust-lang/crates.io-index" 764source = "registry+https://github.com/rust-lang/crates.io-index"
707checksum = "d3058bc37c433096b2ac7afef1c5cdfae49ede0a4ffec3dfc1df1df0959d0ff0" 765checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
708dependencies = [ 766dependencies = [
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]]
717name = "pdcurses-sys" 772name = "parking_lot_core"
718version = "0.7.1" 773version = "0.7.2"
719source = "registry+https://github.com/rust-lang/crates.io-index" 774source = "registry+https://github.com/rust-lang/crates.io-index"
720checksum = "084dd22796ff60f1225d4eb6329f33afaf4c85419d51d440ab6b8c6f4529166b" 775checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
721dependencies = [ 776dependencies = [
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]]
727name = "pkg-config"
728version = "0.3.18"
729source = "registry+https://github.com/rust-lang/crates.io-index"
730checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33"
731
732[[package]]
733name = "proc-macro-hack" 786name = "proc-macro-hack"
734version = "0.5.16" 787version = "0.5.16"
735source = "registry+https://github.com/rust-lang/crates.io-index" 788source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -760,6 +813,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
760checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" 813checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
761 814
762[[package]] 815[[package]]
816name = "redox_termios"
817version = "0.1.1"
818source = "registry+https://github.com/rust-lang/crates.io-index"
819checksum = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
820dependencies = [
821 "redox_syscall",
822]
823
824[[package]]
763name = "redox_users" 825name = "redox_users"
764version = "0.3.4" 826version = "0.3.4"
765source = "registry+https://github.com/rust-lang/crates.io-index" 827source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -798,6 +860,12 @@ dependencies = [
798] 860]
799 861
800[[package]] 862[[package]]
863name = "scopeguard"
864version = "1.1.0"
865source = "registry+https://github.com/rust-lang/crates.io-index"
866checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
867
868[[package]]
801name = "serde" 869name = "serde"
802version = "1.0.114" 870version = "1.0.114"
803source = "registry+https://github.com/rust-lang/crates.io-index" 871source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -835,6 +903,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
835checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed" 903checksum = "604508c1418b99dfe1925ca9224829bb2a8a9a04dda655cc01fcad46f4ab05ed"
836dependencies = [ 904dependencies = [
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"
855checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" 924checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
856 925
857[[package]] 926[[package]]
927name = "smallvec"
928version = "1.4.1"
929source = "registry+https://github.com/rust-lang/crates.io-index"
930checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f"
931
932[[package]]
933name = "socket2"
934version = "0.3.12"
935source = "registry+https://github.com/rust-lang/crates.io-index"
936checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
937dependencies = [
938 "cfg-if",
939 "libc",
940 "redox_syscall",
941 "winapi 0.3.9",
942]
943
944[[package]]
858name = "stable_deref_trait" 945name = "stable_deref_trait"
859version = "1.2.0" 946version = "1.2.0"
860source = "registry+https://github.com/rust-lang/crates.io-index" 947source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -884,13 +971,15 @@ dependencies = [
884] 971]
885 972
886[[package]] 973[[package]]
887name = "term_size" 974name = "termion"
888version = "0.3.2" 975version = "1.5.5"
889source = "registry+https://github.com/rust-lang/crates.io-index" 976source = "registry+https://github.com/rust-lang/crates.io-index"
890checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9" 977checksum = "c22cec9d8978d906be5ac94bceb5a010d885c626c4c8855721a4dbd20e3ac905"
891dependencies = [ 978dependencies = [
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"
1030checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1119checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
1031 1120
1032[[package]] 1121[[package]]
1033name = "winreg"
1034version = "0.5.1"
1035source = "registry+https://github.com/rust-lang/crates.io-index"
1036checksum = "a27a759395c1195c4cc5cda607ef6f8f6498f64e78f7900f5de0a127a424704a"
1037dependencies = [
1038 "winapi 0.3.9",
1039]
1040
1041[[package]]
1042name = "ws2_32-sys" 1122name = "ws2_32-sys"
1043version = "0.2.1" 1123version = "0.2.1"
1044source = "registry+https://github.com/rust-lang/crates.io-index" 1124source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 57f659b..fa7b033 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -24,7 +24,6 @@ toml = "0.5.6"
24[dependencies.cursive] 24[dependencies.cursive]
25version = "0.15" 25version = "0.15"
26default-features = false 26default-features = false
27features = ["pancurses-backend"]
28 27
29[dependencies.chrono] 28[dependencies.chrono]
30version = "0.4" 29version = "0.4"
@@ -33,3 +32,8 @@ features = ["serde"]
33[dependencies.serde] 32[dependencies.serde]
34version = "1.0.103" 33version = "1.0.103"
35features = ["derive"] 34features = ["derive"]
35
36[features]
37default = ["termion-backend"]
38termion-backend = ["cursive/termion-backend"]
39crossterm-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};
12use crate::utils::{load_configuration_file, AppConfig}; 12use crate::utils::{load_configuration_file, AppConfig};
13 13
14use clap::{App as ClapApp, Arg}; 14use clap::{App as ClapApp, Arg};
15use cursive::pancurses; 15
16#[cfg(any(feature = "termion-backend", feature = "default"))]
17use cursive::termion;
18
19#[cfg(feature = "crossterm-backend")]
20use cursive::crossterm;
21
16use cursive::views::{LinearLayout, NamedView}; 22use cursive::views::{LinearLayout, NamedView};
17use lazy_static::lazy_static; 23use 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(