tmkw / sf_cli

A Ruby class library for Salesforce CLI
https://tmkw.github.io/sf_cli/
MIT License
0 stars 0 forks source link

0.0.7: `sf apex run` #72

Closed tmkw closed 2 months ago

tmkw commented 2 months ago
$ sf apex run --target-org dev --json
 ›   Warning: @salesforce/cli update available from 2.56.7 to 2.58.7.
Start typing Apex code. Press the Enter key after each line, then press CTRL+D when finished.
Account account = [Select Id, Name from Account limit 1];
System.debug(account.Name);
{
  "status": 0,
  "result": {
    "success": true,
    "compiled": true,
    "compileProblem": "",
    "exceptionMessage": "",
    "exceptionStackTrace": "",
    "line": -1,
    "column": -1,
    "logs": "61.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO\nExecute Anonymous: Account account = [Select Id, Name from Account limit 1];\nExecute Anonymous: System.debug(account.Name);\n00:13:02.23 (23251327)|USER_INFO|[EXTERNAL]|0055j00000AUSsW|tmaekawa@example.sandbox|(GMT+09:00) 日本標準時 (Asia/Tokyo)|GMT+09:00\n00:13:02.23 (23300949)|EXECUTION_STARTED\n00:13:02.23 (23338603)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex\n00:13:02.23 (28760459)|USER_DEBUG|[2]|DEBUG|はげてないよ\n00:13:02.28 (28931022)|CUMULATIVE_LIMIT_USAGE\n00:13:02.28 (28931022)|LIMIT_USAGE_FOR_NS|(default)|\n  Number of SOQL queries: 1 out of 100\n  Number of query rows: 1 out of 50000\n  Number of SOSL queries: 0 out of 20\n  Number of DML statements: 0 out of 150\n  Number of Publish Immediate DML: 0 out of 150\n  Number of DML rows: 0 out of 10000\n  Maximum CPU time: 0 out of 10000\n  Maximum heap size: 0 out of 6000000\n  Number of callouts: 0 out of 100\n  Number of Email Invocations: 0 out of 10\n  Number of future calls: 0 out of 50\n  Number of queueable jobs added to the queue: 0 out of 50\n  Number of Mobile Apex push calls: 0 out of 10\n\n00:13:02.28 (28931022)|CUMULATIVE_LIMIT_USAGE_END\n\n00:13:02.23 (28993050)|CODE_UNIT_FINISHED|execute_anonymous_apex\n00:13:02.23 (29015152)|EXECUTION_FINISHED\n"
  },
  "warnings": []
}
tmkw commented 2 months ago

this is human readable output:

$ sf apex run --target-org dev
 ›   Warning: @salesforce/cli update available from 2.56.7 to 2.58.7.
Start typing Apex code. Press the Enter key after each line, then press CTRL+D when finished.
> Account account = [Select Id, Name from Account limit 1];
System.debug(account.Name);
Compiled successfully.
Executed successfully.

61.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO
Execute Anonymous: Account account = [Select Id, Name from Account limit 1];
Execute Anonymous: System.debug(account.Name);
00:10:51.27 (27304955)|USER_INFO|[EXTERNAL]|0055j00000AUSsW|tmaekawa@example.sandbox|(GMT+09:00) 日本標準時 (Asia/Tokyo)|GMT+09:00
00:10:51.27 (27351542)|EXECUTION_STARTED
00:10:51.27 (27389512)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
00:10:51.27 (42192908)|USER_DEBUG|[2]|DEBUG|はげてないよ
00:10:51.42 (42354644)|CUMULATIVE_LIMIT_USAGE
00:10:51.42 (42354644)|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 1 out of 100
  Number of query rows: 1 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of Publish Immediate DML: 0 out of 150
  Number of DML rows: 0 out of 10000
  Maximum CPU time: 0 out of 10000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 100
  Number of Email Invocations: 0 out of 10
  Number of future calls: 0 out of 50
  Number of queueable jobs added to the queue: 0 out of 50
  Number of Mobile Apex push calls: 0 out of 10

00:10:51.42 (42354644)|CUMULATIVE_LIMIT_USAGE_END

00:10:51.27 (42842720)|CODE_UNIT_FINISHED|execute_anonymous_apex
00:10:51.27 (42869792)|EXECUTION_FINISHED
tmkw commented 2 months ago

I need to know how to change child process's input and output. OR, Just using temp file can be fine.

tmkw commented 2 months ago

done https://github.com/tmkw/sf_cli/pull/88