File tree Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Expand file tree Collapse file tree 3 files changed +37
-4
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,4 @@ Cargo.lock
11
11
** /* .rs.bk
12
12
13
13
# MSVC Windows builds of rustc generate these, which store debugging information
14
- * .pdb
15
-
16
- hidden /
14
+ * .pdb
Original file line number Diff line number Diff line change @@ -12,4 +12,5 @@ regex = "0.1"
12
12
reqwest = { version = " 0.11.0" , features = [" blocking" ] }
13
13
rodio = " 0.17.3"
14
14
sys-info = " 0.7.0"
15
- clap = " 3.0"
15
+ clap = " 3.0"
16
+ clearscreen = " 2.0.1"
Original file line number Diff line number Diff line change @@ -1378,11 +1378,45 @@ impl Executor {
1378
1378
} )
1379
1379
}
1380
1380
1381
+ <<<<<<< HEAD
1382
+ =======
1383
+ "index" => {
1384
+ let findhint = self . pop_stack( ) . get_string( ) ;
1385
+ let findtarget = self . pop_stack( ) . get_list( ) ;
1386
+
1387
+ for index in 0 ..( findtarget. len( ) ) {
1388
+ if findhint == findtarget[ index] . clone( ) . get_string( ) {
1389
+ self . stack. push ( Type :: Number ( index as f64 ) ) ;
1390
+ return ;
1391
+ }
1392
+ }
1393
+ self . log_print( "Error! item not found in this list" . to_owned ( ) + "\n " ) ;
1394
+ self . stack. push( Type :: Error ( String :: from( "item-not-found" ) ) ) ;
1395
+ }
1396
+
1397
+ "cls" => {
1398
+ self . clearscreen( ) ;
1399
+ }
1400
+
1401
+ "clear" => {
1402
+ self . clearscreen( ) ;
1403
+ }
1404
+
1405
+ >>>>>>> 887510 b ( git)
1381
1406
// If it is not recognized as a command, use it as a string.
1382
1407
_ => self . stack. push ( Type :: String ( command ) ) ,
1383
1408
}
1384
1409
}
1385
1410
1411
+ fn clearscreen ( & mut self ) {
1412
+ let result = clearscreen:: clear ( ) ;
1413
+ if result. is_err( ) {
1414
+ println ! ( "Error! Failed to clear screen" ) ;
1415
+ self . stack
1416
+ . push( Type :: Error ( String :: from( "failed-to-clear-screen" ) ) ) ;
1417
+ }
1418
+ }
1419
+
1386
1420
/// Pop stack's top value
1387
1421
fn pop_stack ( & mut self ) -> Type {
1388
1422
if let Some ( value) = self . stack. pop ( ) {
You can’t perform that action at this time.
0 commit comments