Bläddra i källkod

get script path from cli argument

Oliver Fabel 1 år sedan
förälder
incheckning
19a59ec809
2 ändrade filer med 21 tillägg och 7 borttagningar
  1. 5 1
      CHANGELOG.md
  2. 16 6
      upython.c

+ 5 - 1
CHANGELOG.md

@@ -7,7 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 
 ## [Unreleased]
 ## [Unreleased]
 
 
-## [1.3.0]
+### Added
+
+* Allow passing the path to the script to execute as a CLI argument.
+
+## [1.3.0] - 2024-09-08
 
 
 ### Added
 ### Added
 
 

+ 16 - 6
upython.c

@@ -146,24 +146,34 @@ static void show_splash_screen() {
     furi_record_close(RECORD_GUI);
     furi_record_close(RECORD_GUI);
 }
 }
 
 
-int32_t upython(void* p) {
-    UNUSED(p);
-
+int32_t upython(void* args) {
     do {
     do {
-        show_splash_screen();
+        if(args == NULL) {
+            show_splash_screen();
+        }
 
 
         if(action == ActionExit) {
         if(action == ActionExit) {
             break;
             break;
         }
         }
 
 
-        FuriString* file_path = furi_string_alloc_set_str(APP_ASSETS_PATH("upython"));
+        FuriString* file_path = NULL;
+
+        if(args != NULL) {
+            file_path = furi_string_alloc_set_str(args);
+        } else {
+            file_path = furi_string_alloc_set_str(APP_ASSETS_PATH("upython"));
+        }
 
 
-        if(select_python_file(file_path)) {
+        if(args != NULL || select_python_file(file_path)) {
             execute_file(file_path);
             execute_file(file_path);
         }
         }
 
 
         furi_string_free(file_path);
         furi_string_free(file_path);
 
 
+        if(args != NULL) {
+            break;
+        }
+
         action = ActionNone;
         action = ActionNone;
     } while(true);
     } while(true);