Skip to content

Commit

Permalink
fix(src/cli/cli.cc): fixes for build and run commands
Browse files Browse the repository at this point in the history
  • Loading branch information
chicoxyzzy committed Oct 31, 2023
1 parent dd6b12f commit 4a9d4d4
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 53 deletions.
48 changes: 26 additions & 22 deletions api/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ ssc build [options] [<project-dir>]
| --- | --- |
| --platform=<platform> | platform target to build application for (defaults to host):<br>- android<br>- android-emulator<br>- ios<br>- ios-simulator |
| --port=<port> | load "index.html" from "http://localhost:<port>" |
| --host=<host> | load "index.html" from "http://<host>" |
| --test[=path] | indicate test mode, optionally importing a test file relative to resource files |
| --headless | build application to run in headless mode (without frame or window) |
| --prod | build for production (disables debugging info, inspector, etc.) |
| --stdin | read from stdin (dispacted as 'process.stdin' event to window #0) |
| -D, --debug | enable debug mode |
| -E, --env | add environment variables |
| -o, --only-build | only run build step, |
| -p, --package | package the app for distribution |
| -q, --quiet | hint for less log output |
Expand All @@ -65,20 +66,41 @@ ssc build [options] [<project-dir>]
### macOS options
| Option | Description |
| --- | --- |
| -c | code sign application with 'codesign' |
| -n | notarize application with 'notarytool' |
| -c, --codesign | code sign application with 'codesign' |
| -n, --notarize | notarize application with 'notarytool' |
| -f, --package-format=<format> | package a macOS application in a specified format for distribution:<br>- zip (default)<br>- pkg |

### iOS options
| Option | Description |
| --- | --- |
| -c | code sign application during xcoddbuild<br>(requires '[ios] provisioning_profile' in 'socket.ini') |
| -c, --codesign | code sign application during xcoddbuild<br>(requires '[ios] provisioning_profile' in 'socket.ini') |

### Windows options
| Option | Description |
| --- | --- |
| -f, --package-format=<format> | package a Windows application in a specified format for distribution:<br>- appx (default) |

## ssc run
Run application.

### Usage
```bash
ssc run [options] [<project-dir>]
```

### options
| Option | Description |
| --- | --- |
| --headless | run application in headless mode (without frame or window) |
| --platform=<platform> | platform target to run application on (defaults to host):<br>- android<br>- android-emulator<br>- ios<br>- ios-simulator |
| --port=<port> | load "index.html" from "http://localhost:<port>" |
| --host=<host> | load "index.html" from "http://<host>" |
| --prod | build for production (disables debugging info, inspector, etc.) |
| --test[=path] | indicate test mode, optionally importing a test file relative to resource files |
| -D, --debug | enable debug mode |
| -E, --env | add environment variables |
| -V, --verbose | enable verbose output |

## ssc list-devices
Get the list of connected devices.

Expand Down Expand Up @@ -146,24 +168,6 @@ ssc print-build-dir [--platform=<platform>] [--prod] [--root] [<project-dir>]
| --prod | indicate production build directory |
| --root | print the root build directory |

## ssc run
Run application.

### Usage
```bash
ssc run [options] [<project-dir>]
```

### options
| Option | Description |
| --- | --- |
| -D, --debug | enable debug mode |
| --headless | run application in headless mode (without frame or window) |
| --platform=<platform> | platform target to run application on (defaults to host):<br>- android<br>- android-emulator<br>- ios<br>- ios-simulator |
| --prod | build for production (disables debugging info, inspector, etc.) |
| --test[=path] | indicate test mode, optionally importing a test file relative to resource files |
| -V, --verbose | enable verbose output |

## ssc setup
Setup build tools for host or target platform.
Platforms not listed below can be setup using instructions at https://socketsupply.co/guides
Expand Down
10 changes: 4 additions & 6 deletions src/cli/cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2575,22 +2575,20 @@ int main (const int argc, const char* argv[]) {
{ { "--headless", "-H" }, true, false },
{ { "--debug", "-D" }, true, false },
{ { "--verbose", "-V" }, true, false },
{ { "--env", "-E" }, true, true }
{ { "--env", "-E" }, true, true },
{ { "--port" }, true, true },
{ { "--host"}, true, true }
};

Options buildOptions = {
{ { "--quiet", "-q" }, true, false },
{ { "--only-build", "-o" }, true, false },
{ { "--run", "-r" }, true, false },
{ { "--watch", "-W" }, true, false },
{ { "--debug", "-D" }, true, false },
{ { "--verbose", "-V" }, true, false },
{ { "--prod", "-P" }, true, false },
{ { "--package", "-p" }, true, false },
{ { "--package-format", "-f" }, true, true },
{ { "--codesign", "-c" }, true, false },
{ { "--notarize", "-n" }, true, false },
{ { "--env", "-E" }, true, true }
{ { "--notarize", "-n" }, true, false }
};

// Insert the elements of runOptions into buildOptions
Expand Down
54 changes: 29 additions & 25 deletions src/cli/templates.hh
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ options:
- ios
- ios-simulator
--port=<port> load "index.html" from "http://localhost:<port>"
--host=<host> load "index.html" from "http://<host>"
--test[=path] indicate test mode, optionally importing a test file relative to resource files
--headless build application to run in headless mode (without frame or window)
--prod build for production (disables debugging info, inspector, etc.)
--stdin read from stdin (dispacted as 'process.stdin' event to window #0)
-D, --debug enable debug mode
-E, --env add environment variables
-o, --only-build only run build step,
-p, --package package the app for distribution
-q, --quiet hint for less log output
Expand All @@ -57,21 +58,45 @@ Linux options:
- zip
macOS options:
-c code sign application with 'codesign'
-n notarize application with 'notarytool'
-c, --codesign code sign application with 'codesign'
-n, --notarize notarize application with 'notarytool'
-f, --package-format=<format> package a macOS application in a specified format for distribution:
- zip (default)
- pkg
iOS options:
-c code sign application during xcoddbuild
-c, --codesign code sign application during xcoddbuild
(requires '[ios] provisioning_profile' in 'socket.ini')
Windows options:
-f, --package-format=<format> package a Windows application in a specified format for distribution:
- appx (default)
)TEXT";

constexpr auto gHelpTextRun = R"TEXT(
ssc v{{ssc_version}}
Run application.
usage:
ssc run [options] [<project-dir>]
options:
--headless run application in headless mode (without frame or window)
--platform=<platform> platform target to run application on (defaults to host):
- android
- android-emulator
- ios
- ios-simulator
--port=<port> load "index.html" from "http://localhost:<port>"
--host=<host> load "index.html" from "http://<host>"
--prod build for production (disables debugging info, inspector, etc.)
--test[=path] indicate test mode, optionally importing a test file relative to resource files
-D, --debug enable debug mode
-E, --env add environment variables
-V, --verbose enable verbose output
)TEXT";

constexpr auto gHelpTextListDevices = R"TEXT(
ssc v{{ssc_version}}
Expand Down Expand Up @@ -143,27 +168,6 @@ options:
--root print the root build directory
)TEXT";

constexpr auto gHelpTextRun = R"TEXT(
ssc v{{ssc_version}}
Run application.
usage:
ssc run [options] [<project-dir>]
options:
-D, --debug enable debug mode
--headless run application in headless mode (without frame or window)
--platform=<platform> platform target to run application on (defaults to host):
- android
- android-emulator
- ios
- ios-simulator
--prod build for production (disables debugging info, inspector, etc.)
--test[=path] indicate test mode, optionally importing a test file relative to resource files
-V, --verbose enable verbose output
)TEXT";

constexpr auto gHelpTextSetup = R"TEXT(
ssc v{{ssc_version}}
Expand Down

0 comments on commit 4a9d4d4

Please sign in to comment.