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
//! # leetcode-cli
//! [![doc](https://img.shields.io/badge/0.1.8-docs-green.svg)](https://docs.rs/leetcode-cli/)
//! [![Crates.io](https://img.shields.io/crates/v/leetcode-cli.svg)](https://crates.io/crates/leetcode-cli)
//! [![Crates.io](https://img.shields.io/crates/d/leetcode-cli.svg)](https://crates.io/crates/leetcode-cli)
//! [![LICENSE](https://img.shields.io/crates/l/leetcode-cli.svg)](https://choosealicense.com/licenses/mit/)
//! 
//! ## Note - Not Available for Now
//! > (only support OSX temporarily) [#1][#1]
//! 
//! Please make sure you have logined in `leetcode.com` with `chrome`.
//! 
//! 
//! ## Features
//! 
//! 1. the edit flow —— solution files will generate automatically!
//! 2. doc support, `lc-rs` can compile the annotation of your solutions to markdown!
//!    1. btw, generate a site is easy for `lc-rs`!
//! 3. support local signal to keep coding as longer as you want.
//! 
//! 
//! ## Building
//! 
//! ```sh
//! cargo install leetcode-cli
//! ```
//! 
//! 
//! ## Usage
//! ```sh
//! leetcode 0.1.9
//! clearloop <udtrokia@163.com>
//! Here's to the crazy ones 👻
//! 
//! USAGE:
//!     leetcode [FLAGS] [SUBCOMMAND]
//! 
//! FLAGS:
//!     -d, --debug      debug mode
//!     -h, --help       Prints help information
//!     -V, --version    Prints version information
//! 
//! SUBCOMMANDS:
//!     data    Manage Cache [aliases: d]
//!     edit    Edit question by id [aliases: e]
//!     exec    Submit solution [aliases: x]
//!     list    List problems [aliases: l]
//!     pick    Pick a problem [aliases: p]
//!     stat    Show simple chart about submissions [aliases: s]
//!     test    Edit question by id [aliases: t]
//!     help    Prints this message or the help of the given subcommand(s)
//! ```
//! 
//! ## Example
//! 
//! For example, if your config is:
//! 
//! ```toml
//! [storage]
//! code = "code"
//! 
//! [code]
//! lang = "rust"
//! editor = "emacs"
//! ```
//! 
//! #### 1. <kbd>pick</kbd>
//! 
//! ```sh
//! leetcode pick 1
//! ```
//! 
//! ```sh
//! [1] Two Sum is on the run...
//! 
//! 
//! Given an array of integers, return indices of the two numbers such that they add up to a specific target.
//! 
//! You may assume that each input would have exactly one solution, and you may not use the same element twice.
//! 
//! --------------------------------------------------
//! 
//! Example:
//! 
//! 
//! Given nums = [2, 7, 11, 15], target = 9,
//! 
//! Because nums[0] + nums[1] = 2 + 7 = 9,
//! return [0, 1].
//! ```
//! 
//! #### 2. <kbd>edit</kbd>
//! 
//! ```sh
//! leetcode edit 1
//! ```
//! 
//! ```rust
//! # struct Solution;
//! 
//! impl Solution {
//!     pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> {
//!         use std::collections::HashMap;
//!         let mut m: HashMap<i32, i32> = HashMap::new();
//! 
//!         for (i, e) in nums.iter().enumerate() {
//!             if let Some(v) = m.get(&(target - e)) {
//!                 return vec![*v, i as i32];
//!             }
//! 
//!             m.insert(*e, i as i32).unwrap_or_default();
//!         }
//! 
//!         return vec![];
//!     }
//! }
//! ```
//! 
//! #### 3. <kbd>test</kbd>
//! 
//! ```sh
//! leetcode test 1
//! ```
//! 
//! ```sh
//! 
//!   Accepted       Runtime: 0 ms
//! 
//!   Your input:    [2,7,11,15], 9
//!   Output:        [0,1]
//!   Expected:      [0,1]
//! 
//! ```
//! 
//! #### 4. <kbd>submit</kbd>
//! 
//! ```sh
//! leetcode submit 1
//! ```
//! 
//! ```sh
//! 
//!   Success
//! 
//!   Runtime: 0 ms, faster than 100% of Rustonline submissions for Two Sum.
//! 
//!   Memory Usage: 2.4 MB, less than 100% of Rustonline submissions for Two Sum.
//! 
//! 
//! ```
//! 
//! ## PR
//! 
//! PR is welcome, [here][pr] it is.
//! 
//! ## LICENSE
//! MIT
//! 
//! [pr]: https://github.com/clearloop/leetcode-cli/pulls
//! [#1]: https://github.com/clearloop/leetcode-cli/issues/1
#![feature(try_trait)]
#[macro_use]
extern crate log;
#[macro_use]
extern crate diesel;

/// show docs
pub mod cfg;
pub mod err;
pub mod cmds;
pub mod flag;
pub mod cache;
pub mod helper;
pub mod plugins;
/// really pub
pub mod cli;

/// re-exports
pub use cfg::Config;
pub use err::Error;
pub use cache::Cache;