MCPcopy Create free account
hub / github.com/GNOME/gjs / breakcmd

Function breakcmd

modules/script/_bootstrap/debugger.js:929–937  ·  view source on GitHub ↗
(cmd)

Source from the content-addressed store, hash-verified

927// print/b x => ['print', '/b x']
928//
929function breakcmd(cmd) {
930 cmd = cmd.trimStart();
931 if ("!@#$%^&*_+=/?.,<>:;'\"".includes(cmd.substr(0, 1)))
932 return [cmd.substr(0, 1), cmd.substr(1).trimStart()];
933 var m = /\s+|(?=\/)/.exec(cmd);
934 if (m === null)
935 return [cmd, ''];
936 return [cmd.slice(0, m.index), cmd.slice(m.index + m[0].length)];
937}
938
939function runcmd(cmd) {
940 var pieces = breakcmd(cmd);

Callers 1

runcmdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected