summary refs log tree commit diff stats
path: root/valentine
diff options
context:
space:
mode:
authorCrystal <crystal@wizard.tower>2024-04-19 19:34:30 +0100
committerCrystal <crystal@wizard.tower>2024-04-19 19:34:30 +0100
commita4c6f5994dfab1a49ec5756619f7148a00067671 (patch)
treedbd7e583c86c7883f193dd9975ca6637ee0c6869 /valentine
parent2c95dd5c9d5cf4f893e6829d9233d28ae34b4220 (diff)
downloadwww-a4c6f5994dfab1a49ec5756619f7148a00067671.tar.gz
drone.yml update N⁰2 and 3/2
Diffstat (limited to 'valentine')
0 files changed, 0 insertions, 0 deletions
61ad6b711e89a92ce65fa'>^
583a966d ^

3962ac59 ^





583a966d ^

7d15b088 ^
3962ac59 ^

583a966d ^
3962ac59 ^
583a966d ^

7d15b088 ^
3962ac59 ^



3962ac59 ^



3962ac59 ^



492fb278 ^

















































































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








                                                                              


                                                                                       





                        





























                                                                                      


               





                                                                              

                                   





                                              

               
                                     

                                        
                                          
                               

                 
             



                                 



                 



                        

















































































                                                                                                   
='alt'>
bb327d3 ^
99c5537 ^
eca1e0a ^


841e6a3 ^
c5ea653 ^
8d50587 ^
841e6a3 ^
bb327d3 ^
841e6a3 ^

8ecc294 ^
841e6a3 ^
bb327d3 ^
05649a5 ^
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

              


                         
         
       
       
          
            
          
         
 
           
                                   
                                     
                            
 
                                      
                                                   
                                           
               
 


                                                                               
 
                                                         
                                  
                                                                  
                                                                             
                                                                    
                                                           


                
 
                                        

                      
                                      

                                                           
                                                                             
                                                                    
                                                           


                
 
                                    
 
                      
                                      

                                                           
     
 
                                                              
 
use std::time;

#[macro_use]
extern crate lazy_static;

mod conf;
mod db;
mod ed;
mod error;
mod logging;
mod posts;
mod user;

fn main() {
    let arg_matches = &*conf::ARGS;
    let start = time::Instant::now();
    logging::checked_init();

    log::info!("clinte starting up!");
    println!("clinte v{}", clap::crate_version!());
    println!("a community notices system");
    println!();

    if *conf::DEBUG {
        log::info!("Startup completed in {:?}ms", start.elapsed().as_millis());
    }

    if arg_matches.subcommand_matches("post").is_some() {
        log::info!("New post...");
        error::helper(posts::create(), "Error creating new post");
    } else if let Some(updmatch) = arg_matches.subcommand_matches("update") {
        let id: usize = if let Some(val) = updmatch.value_of("id") {
            error::helper(val.parse(), "Couldn't parse ID")
        } else {
            0
        };

        log::info!("Updating post ...");

        error::helper(
            posts::update_handler(id),
            format!("Error updating post {}", id).as_ref(),
        );
    } else if let Some(delmatch) = arg_matches.subcommand_matches("delete") {
        let id: usize = if let Some(val) = delmatch.value_of("id") {
            error::helper(val.parse(), "Couldn't parse ID")
        } else {
            0
        };

        log::info!("Deleting post");

        error::helper(
            posts::delete_handler(id),
            format!("Error deleting post {}", id).as_ref(),
        );
    }

    error::helper(posts::display(), "Error displaying posts");
}