dashcam 1.0.1-beta.12 → 1.0.1-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/dashcam.js +23 -59
  2. package/package.json +1 -1
package/bin/dashcam.js CHANGED
@@ -310,75 +310,39 @@ program
310
310
  program
311
311
  .command('track')
312
312
  .description('Add a logs config to Dashcam')
313
- .option('--name <name>', 'Name for the tracking configuration (required)')
314
- .option('--type <type>', 'Type of tracker: "application" or "web" (required)')
315
- .option('--pattern <pattern>', 'Pattern to track (can be used multiple times)', (value, previous) => {
316
- return previous ? previous.concat([value]) : [value];
317
- })
318
- .option('--web <pattern>', 'Web URL pattern to track (can use wildcards like *) - deprecated, use --type=web --pattern instead')
319
- .option('--app <pattern>', 'Application file pattern to track (can use wildcards like *) - deprecated, use --type=application --pattern instead')
313
+ .option('--web <pattern>', 'Web URL pattern to track (can use wildcards like *)')
314
+ .option('--app <pattern>', 'Application file pattern to track (can use wildcards like *)')
320
315
  .action(async (options) => {
321
316
  try {
322
- // Support both old and new syntax
323
- // New syntax: --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"
324
- // Old syntax: --web <pattern> --app <pattern>
325
-
326
- if (options.type && options.pattern) {
327
- // New syntax validation
328
- if (!options.name) {
329
- console.error('Error: --name is required when using --type and --pattern');
330
- console.log('Example: dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"');
331
- process.exit(1);
332
- }
333
-
334
- if (options.type !== 'web' && options.type !== 'application') {
335
- console.error('Error: --type must be either "web" or "application"');
336
- process.exit(1);
337
- }
338
-
317
+ if (options.web) {
339
318
  const config = {
340
- name: options.name,
341
- type: options.type,
342
- patterns: options.pattern,
319
+ name: 'Web Pattern',
320
+ type: 'web',
321
+ patterns: [options.web],
343
322
  enabled: true
344
323
  };
345
324
 
346
325
  await createPattern(config);
347
- console.log(`${options.type === 'web' ? 'Web' : 'Application'} tracking pattern added successfully:`, options.name);
348
- console.log('Patterns:', options.pattern.join(', '));
349
-
350
- } else if (options.web || options.app) {
351
- // Old syntax for backward compatibility
352
- if (options.web) {
353
- const config = {
354
- name: options.name || 'Web Pattern',
355
- type: 'web',
356
- patterns: [options.web],
357
- enabled: true
358
- };
359
-
360
- await createPattern(config);
361
- console.log('Web tracking pattern added successfully:', options.web);
362
- }
326
+ console.log('Web tracking pattern added successfully:', options.web);
327
+ }
363
328
 
364
- if (options.app) {
365
- const config = {
366
- name: options.name || 'App Pattern',
367
- type: 'application',
368
- patterns: [options.app],
369
- enabled: true
370
- };
371
-
372
- await createPattern(config);
373
- console.log('Application tracking pattern added successfully:', options.app);
374
- }
375
- } else {
376
- console.error('Error: Must provide either:');
377
- console.log(' --name --type --pattern (new syntax)');
378
- console.log(' --web or --app (old syntax)');
329
+ if (options.app) {
330
+ const config = {
331
+ name: 'App Pattern',
332
+ type: 'application',
333
+ patterns: [options.app],
334
+ enabled: true
335
+ };
336
+
337
+ await createPattern(config);
338
+ console.log('Application tracking pattern added successfully:', options.app);
339
+ }
340
+
341
+ if (!options.web && !options.app) {
342
+ console.error('Error: Must provide either --web or --app');
379
343
  console.log('\nExamples:');
380
- console.log(' dashcam track --name=social --type=web --pattern="*facebook.com*" --pattern="*twitter.com*"');
381
344
  console.log(' dashcam track --web "*facebook.com*"');
345
+ console.log(' dashcam track --app "/var/log/app.log"');
382
346
  process.exit(1);
383
347
  }
384
348
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashcam",
3
- "version": "1.0.1-beta.12",
3
+ "version": "1.0.1-beta.13",
4
4
  "description": "Minimal CLI version of Dashcam desktop app",
5
5
  "main": "bin/index.js",
6
6
  "bin": {