mirror of
https://github.com/HeyPuter/puter
synced 2024-11-14 22:06:00 +00:00
Remove a whole load of noisy log messages
These can be added back if and when we need them, but right now, it's
hard to follow console output with all this chatter. 😅
This commit is contained in:
parent
072dbe8db5
commit
2f49c1c9b0
@ -23,7 +23,6 @@ export default class StrUntilParserImpl {
|
||||
parse (lexer) {
|
||||
let text = '';
|
||||
for ( ;; ) {
|
||||
console.log('B')
|
||||
let { done, value } = lexer.look();
|
||||
|
||||
if ( done ) break;
|
||||
@ -41,8 +40,6 @@ export default class StrUntilParserImpl {
|
||||
|
||||
if ( text.length === 0 ) return;
|
||||
|
||||
console.log('test?', text)
|
||||
|
||||
return { $: 'until', text };
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ export default class ContextSwitchingPStratumImpl {
|
||||
constructor ({ contexts, entry }) {
|
||||
this.contexts = { ...contexts };
|
||||
for ( const key in this.contexts ) {
|
||||
console.log('parsers?', this.contexts[key]);
|
||||
const new_array = [];
|
||||
for ( const parser of this.contexts[key] ) {
|
||||
if ( parser.hasOwnProperty('transition') ) {
|
||||
@ -44,7 +43,6 @@ export default class ContextSwitchingPStratumImpl {
|
||||
this.lastvalue = null;
|
||||
}
|
||||
get stack_top () {
|
||||
console.log('stack top?', this.stack[this.stack.length - 1])
|
||||
return this.stack[this.stack.length - 1];
|
||||
}
|
||||
get current_context () {
|
||||
@ -55,7 +53,6 @@ export default class ContextSwitchingPStratumImpl {
|
||||
const lexer = api.delegate;
|
||||
|
||||
const context = this.current_context;
|
||||
console.log('context?', context);
|
||||
for ( const spec of context ) {
|
||||
{
|
||||
const { done, value } = lexer.look();
|
||||
@ -64,7 +61,6 @@ export default class ContextSwitchingPStratumImpl {
|
||||
throw new Error('infinite loop');
|
||||
}
|
||||
this.lastvalue = value;
|
||||
console.log('last value?', value, done);
|
||||
if ( done ) return { done };
|
||||
}
|
||||
|
||||
@ -76,7 +72,6 @@ export default class ContextSwitchingPStratumImpl {
|
||||
}
|
||||
|
||||
const subLexer = lexer.fork();
|
||||
// console.log('spec?', spec);
|
||||
const result = parser.parse(subLexer);
|
||||
if ( result.status === ParseResult.UNRECOGNIZED ) {
|
||||
continue;
|
||||
@ -84,11 +79,9 @@ export default class ContextSwitchingPStratumImpl {
|
||||
if ( result.status === ParseResult.INVALID ) {
|
||||
return { done: true, value: result };
|
||||
}
|
||||
console.log('RESULT', result, spec)
|
||||
if ( ! peek ) lexer.join(subLexer);
|
||||
|
||||
if ( transition ) {
|
||||
console.log('GOT A TRANSITION')
|
||||
if ( transition.pop ) this.stack.pop();
|
||||
if ( transition.to ) this.stack.push({
|
||||
context_name: transition.to,
|
||||
@ -97,7 +90,6 @@ export default class ContextSwitchingPStratumImpl {
|
||||
|
||||
if ( result.value.$discard || peek ) return this.next(api);
|
||||
|
||||
console.log('PROVIDING VALUE', result.value);
|
||||
return { done: false, value: result.value };
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,6 @@ import { DEFAULT_OPTIONS } from '../../puter-shell/coreutils/coreutil_lib/help.j
|
||||
export default {
|
||||
name: 'simple-parser',
|
||||
async process (ctx, spec) {
|
||||
console.log({
|
||||
...spec,
|
||||
args: ctx.locals.args
|
||||
});
|
||||
|
||||
// Insert standard options
|
||||
spec.options = Object.assign(spec.options || {}, DEFAULT_OPTIONS);
|
||||
|
||||
|
@ -37,7 +37,6 @@ export class PuterShellParser {
|
||||
if ( sp.error ) {
|
||||
throw new Error(sp.error);
|
||||
}
|
||||
console.log('PARSER RESULT', result);
|
||||
return result;
|
||||
}
|
||||
parseScript (input) {
|
||||
|
@ -54,7 +54,6 @@ class ReducePrimitivesPStratumImpl {
|
||||
let text = '';
|
||||
for ( const item of contents.results ) {
|
||||
if ( item.$ === 'string.segment' ) {
|
||||
// console.log('segment?', item.text)
|
||||
text += item.text;
|
||||
continue;
|
||||
}
|
||||
@ -86,7 +85,6 @@ class ShellConstructsPStratumImpl {
|
||||
node.commands = [];
|
||||
},
|
||||
exit ({ node }) {
|
||||
console.log('!!!!!',this.stack_top.node)
|
||||
if ( this.stack_top?.node?.$ === 'script' ) {
|
||||
this.stack_top.node.statements.push(node);
|
||||
}
|
||||
@ -96,7 +94,6 @@ class ShellConstructsPStratumImpl {
|
||||
},
|
||||
next ({ value, lexer }) {
|
||||
if ( value.$ === 'op.line-terminator' ) {
|
||||
console.log('the stack??', this.stack)
|
||||
this.pop();
|
||||
return;
|
||||
}
|
||||
@ -189,7 +186,6 @@ class ShellConstructsPStratumImpl {
|
||||
},
|
||||
next ({ value, lexer }) {
|
||||
if ( value.$ === 'op.line-terminator' ) {
|
||||
console.log('well, got here')
|
||||
this.pop();
|
||||
return;
|
||||
}
|
||||
@ -223,9 +219,7 @@ class ShellConstructsPStratumImpl {
|
||||
this.stack_top.node.components.push(...node.components);
|
||||
},
|
||||
next ({ node, value, lexer }) {
|
||||
console.log('WHAT THO', node)
|
||||
if ( value.$ === 'op.line-terminator' && node.quote === null ) {
|
||||
console.log('well, got here')
|
||||
this.pop();
|
||||
return;
|
||||
}
|
||||
@ -292,7 +286,6 @@ class ShellConstructsPStratumImpl {
|
||||
|
||||
const lexer = api.delegate;
|
||||
|
||||
console.log('THE NODE', this.stack[0].node);
|
||||
// return { done: true, value: { $: 'test' } };
|
||||
|
||||
for ( let i=0 ; i < 500 ; i++ ) {
|
||||
@ -306,15 +299,12 @@ class ShellConstructsPStratumImpl {
|
||||
}
|
||||
|
||||
const { state, node } = this.stack_top;
|
||||
console.log('value?', value, done)
|
||||
console.log('state?', state.name);
|
||||
|
||||
state.next.call(this, { lexer, value, node, state });
|
||||
|
||||
// if ( done ) break;
|
||||
}
|
||||
|
||||
console.log('THE NODE', this.stack[0]);
|
||||
|
||||
this.done_ = true;
|
||||
return { done: false, value: this.stack[0].node };
|
||||
@ -433,7 +423,6 @@ export const buildParserSecondHalf = (sp, { multiline } = {}) => {
|
||||
|
||||
// sp.add(new ReducePrimitivesPStratumImpl());
|
||||
if ( multiline ) {
|
||||
console.log('USING MULTILINE');
|
||||
sp.add(new MultilinePStratumImpl());
|
||||
} else {
|
||||
sp.add(new ShellConstructsPStratumImpl());
|
||||
|
@ -38,11 +38,6 @@ class Token {
|
||||
throw new Error('expected token node');
|
||||
}
|
||||
|
||||
console.log('ast has cst?',
|
||||
ast,
|
||||
ast.components?.[0]?.$cst
|
||||
)
|
||||
|
||||
return new Token(ast);
|
||||
}
|
||||
constructor (ast) {
|
||||
@ -53,20 +48,15 @@ class Token {
|
||||
// If the only components are of type 'symbol' and 'string.segment'
|
||||
// then we can statically resolve the value of the token.
|
||||
|
||||
console.log('checking viability of static resolve', this.ast)
|
||||
|
||||
const isStatic = this.ast.components.every(c => {
|
||||
return c.$ === 'symbol' || c.$ === 'string.segment';
|
||||
});
|
||||
|
||||
if ( ! isStatic ) return;
|
||||
|
||||
console.log('doing static thing', this.ast)
|
||||
|
||||
// TODO: Variables can also be statically resolved, I think...
|
||||
let value = '';
|
||||
for ( const component of this.ast.components ) {
|
||||
console.log('component', component);
|
||||
value += component.text;
|
||||
}
|
||||
|
||||
@ -113,7 +103,6 @@ export class PreparedCommand {
|
||||
|
||||
// TODO: check that node for command name is of a
|
||||
// supported type - maybe use adapt pattern
|
||||
console.log('ast?', ast);
|
||||
const cmd = command_token.maybeStaticallyResolve(ctx);
|
||||
|
||||
const { commands } = ctx.registries;
|
||||
@ -124,16 +113,13 @@ export class PreparedCommand {
|
||||
: command_token;
|
||||
|
||||
if ( command === undefined ) {
|
||||
console.log('command token?', command_token);
|
||||
throw new ConcreteSyntaxError(
|
||||
`no command: ${JSON.stringify(cmd)}`,
|
||||
command_token.$cst,
|
||||
);
|
||||
throw new Error('no command: ' + JSON.stringify(cmd));
|
||||
}
|
||||
|
||||
// TODO: test this
|
||||
console.log('ast?', ast);
|
||||
const inputRedirect = ast.inputRedirects.length > 0 ? (() => {
|
||||
const token = Token.createFromAST(ctx, ast.inputRedirects[0]);
|
||||
return token.maybeStaticallyResolve(ctx) ?? token;
|
||||
@ -172,7 +158,6 @@ export class PreparedCommand {
|
||||
// command to run.
|
||||
if ( command instanceof Token ) {
|
||||
const cmd = await command.resolve(this.ctx);
|
||||
console.log('RUNNING CMD?', cmd)
|
||||
const { commandProvider } = this.ctx.externs;
|
||||
command = await commandProvider.lookup(cmd, { ctx: this.ctx });
|
||||
if ( command === undefined ) {
|
||||
@ -327,23 +312,16 @@ export class PreparedCommand {
|
||||
|
||||
// TODO: need write command from puter-shell before this can be done
|
||||
for ( let i=0 ; i < this.outputRedirects.length ; i++ ) {
|
||||
console.log('output redirect??', this.outputRedirects[i]);
|
||||
const { filesystem } = this.ctx.platform;
|
||||
const outputRedirect = this.outputRedirects[i];
|
||||
const dest_path = outputRedirect instanceof Token
|
||||
? await outputRedirect.resolve(this.ctx)
|
||||
: outputRedirect;
|
||||
const path = resolveRelativePath(ctx.vars, dest_path);
|
||||
console.log('it should work?', {
|
||||
path,
|
||||
outputMemWriters,
|
||||
})
|
||||
// TODO: error handling here
|
||||
|
||||
await filesystem.write(path, outputMemWriters[i].getAsBlob());
|
||||
}
|
||||
|
||||
console.log('OUTPUT WRITERS', outputMemWriters);
|
||||
}
|
||||
}
|
||||
|
||||
@ -405,7 +383,6 @@ export class Pipeline {
|
||||
commandPromises.push(command.execute());
|
||||
}
|
||||
await Promise.all(commandPromises);
|
||||
console.log('PIPELINE DONE');
|
||||
|
||||
await coupler.isDone;
|
||||
}
|
||||
|
@ -96,7 +96,6 @@ const ReadlineProcessorBuilder = builder => builder
|
||||
externs.out.write(externs.prompt);
|
||||
externs.out.write(vars.result);
|
||||
const invCurPos = vars.result.length - vars.cursor;
|
||||
console.log(invCurPos)
|
||||
if ( invCurPos !== 0 ) {
|
||||
externs.out.write(`\x1B[${invCurPos}D`);
|
||||
}
|
||||
@ -111,8 +110,6 @@ const ReadlineProcessorBuilder = builder => builder
|
||||
}
|
||||
}));
|
||||
// NEXT: get tab completer for input state
|
||||
console.log('input state', inputState);
|
||||
|
||||
let completer = null;
|
||||
if ( inputState.$ === 'redirect' ) {
|
||||
completer = new FileCompleter();
|
||||
@ -141,7 +138,6 @@ const ReadlineProcessorBuilder = builder => builder
|
||||
const applyCompletion = txt => {
|
||||
const p1 = vars.result.slice(0, vars.cursor);
|
||||
const p2 = vars.result.slice(vars.cursor);
|
||||
console.log({ p1, p2 });
|
||||
vars.result = p1 + txt + p2;
|
||||
vars.cursor += txt.length;
|
||||
externs.out.write(txt);
|
||||
|
@ -41,27 +41,14 @@ class XTermIO {
|
||||
}
|
||||
|
||||
async handleKeyBeforeProcess (evt) {
|
||||
console.log(
|
||||
'right this event might be up or down so it\'s necessary to determine which',
|
||||
evt,
|
||||
);
|
||||
if ( evt.key === 'V' && evt.ctrlKey && evt.shiftKey && evt.type === 'keydown' ) {
|
||||
const clipboard = navigator.clipboard;
|
||||
const text = await clipboard.readText();
|
||||
console.log(
|
||||
'this is the relevant text for this thing that is the thing that is the one that is here',
|
||||
text,
|
||||
);
|
||||
this.pty.out.write(text);
|
||||
}
|
||||
}
|
||||
|
||||
handleKey ({ key, domEvent }) {
|
||||
console.log(
|
||||
'key event happened',
|
||||
key,
|
||||
domEvent,
|
||||
);
|
||||
const pty = this.pty;
|
||||
|
||||
const handlers = {
|
||||
|
@ -2773,7 +2773,6 @@ window.sidebar_item_droppable = (el_window)=>{
|
||||
// closes a window
|
||||
$.fn.close = async function(options) {
|
||||
options = options || {};
|
||||
console.log(options);
|
||||
$(this).each(async function() {
|
||||
const el_iframe = $(this).find('.window-app-iframe');
|
||||
const app_uses_sdk = el_iframe.length > 0 && el_iframe.attr('data-appUsesSDK') === 'true';
|
||||
|
@ -1839,8 +1839,6 @@ window.launch_app = async (options)=>{
|
||||
// ...and finally append urm_source=puter.com to the URL
|
||||
iframe_url.searchParams.append('urm_source', 'puter.com');
|
||||
|
||||
console.log('backgrounded??', app_info.background);
|
||||
|
||||
el_win = UIWindow({
|
||||
element_uuid: uuid,
|
||||
title: title,
|
||||
@ -1895,7 +1893,6 @@ window.launch_app = async (options)=>{
|
||||
|
||||
(async () => {
|
||||
const el = await el_win;
|
||||
console.log('RESOV', el);
|
||||
$(el).on('remove', () => {
|
||||
const svc_process = globalThis.services.get('process');
|
||||
svc_process.unregister(process.uuid);
|
||||
|
Loading…
Reference in New Issue
Block a user