Skip to content

Commit f5f79e7

Browse files
committed
Fix file type for concatenating origin & CLI help
* Apply file types on all configurations in concatenating origin instead of changing the default only. * Set correct app name in CLI help texts. * Lint fixes
1 parent 9d862c2 commit f5f79e7

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

application/holder/src/loaders/cli.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function setup() {
7272
cli.addOption(
7373
new Option(
7474
'-s, --search "<regexp>"',
75-
'Collection of filters, which would be applied to each opened session (tab). Ex: cm files -o /path/file_name -s "error" -s "warning"',
75+
'Collection of filters, which would be applied to each opened session (tab). Ex: chipmunk files -o /path/file_name -s "error" -s "warning"',
7676
).argParser(parser(CLI_HANDLERS['search'], undefined)),
7777
);
7878
cli.addOption(new Option(RESTARTING_FLAG, 'Hidden option to manage CLI usage').hideHelp());
@@ -90,7 +90,7 @@ function setup() {
9090
});
9191
files.option(
9292
'-o, --open <filename | glob pattern...>',
93-
'Opens file. Ex: cm -o /path/file_name_a. In case of multiple files, concat operation will be done. Ex: cm -o file_a -o file_b; cm -o "**/*.logs"; cm -o "**/*.{logs,txt}"',
93+
'Opens file. Ex: chipmunk -o /path/file_name_a. In case of multiple files, concat operation will be done. Ex: chipmunk -o file_a -o file_b; chipmunk -o "**/*.logs"; chipmunk -o "**/*.{logs,txt}"',
9494
parser(CLI_HANDLERS['open'], undefined),
9595
);
9696
const streams = cli
@@ -99,25 +99,25 @@ function setup() {
9999
streams.addOption(
100100
new Option(
101101
'--tcp "<addr:port>"',
102-
'Creates TCP connection with given address. Ex: cm --tcp "0.0.0.0:8888"',
102+
'Creates TCP connection with given address. Ex: chipmunk --tcp "0.0.0.0:8888"',
103103
).argParser(parser(CLI_HANDLERS['stream'], 'tcp')),
104104
);
105105
streams.addOption(
106106
new Option(
107107
'--udp "<addr:port|multicast,interface;>"',
108-
'Creates UDP connection with given address and multicasts. Ex: cm --udp "0.0.0.0:8888|234.2.2.2,0.0.0.0"',
108+
'Creates UDP connection with given address and multicasts. Ex: chipmunk --udp "0.0.0.0:8888|234.2.2.2,0.0.0.0"',
109109
).argParser(parser(CLI_HANDLERS['stream'], 'udp')),
110110
);
111111
streams.addOption(
112112
new Option(
113113
'--serial "<path;baud_rate;data_bits;flow_control;parity;stop_bits>"',
114-
'Creates serial port connection with given parameters. Ex: cm --serial "/dev/port_a;960000;8;1;0;1"',
114+
'Creates serial port connection with given parameters. Ex: chipmunk --serial "/dev/port_a;960000;8;1;0;1"',
115115
).argParser(parser(CLI_HANDLERS['stream'], 'serial')),
116116
);
117117
streams.addOption(
118118
new Option(
119119
'--stdout "<command...>"',
120-
'Executes given commands in the scope of one session (tab) and shows mixed output. Ex: cm --stdout "journalctl -r" "adb logcat"',
120+
'Executes given commands in the scope of one session (tab) and shows mixed output. Ex: chipmunk --stdout "journalctl -r" "adb logcat"',
121121
).argParser(parser(CLI_HANDLERS['stream'], 'stdout')),
122122
);
123123
cli.parse();

application/holder/src/service/cli/open.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import * as path from 'path';
1010
import * as Requests from 'platform/ipc/request';
1111
import * as Factory from 'platform/types/observe/factory';
1212
import * as Parser from 'platform/types/observe/parser';
13-
import * as Origin from 'platform/types/observe/origin';
14-
import { session } from 'electron';
1513

1614
export class Action extends CLIAction {
1715
protected files: string[] = [];
@@ -64,7 +62,7 @@ export class Action extends CLIAction {
6462
if (files.length === 0) {
6563
return;
6664
}
67-
let factory =
65+
const factory =
6866
files.length === 1
6967
? new Factory.File().file(files[0].filename)
7068
: new Factory.Concat().files(files.map((f) => f.filename));
@@ -83,7 +81,7 @@ export class Action extends CLIAction {
8381
throw new Error("Plugins aren't supperted in CLI yet.");
8482
}
8583

86-
let observe = factory.get();
84+
const observe = factory.get();
8785

8886
return new Promise((resolve, _reject) => {
8987
Requests.IpcRequest.send(

application/platform/types/observe/factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export class Concat extends Factory<Concat> {
196196
if (!(this.observe.origin.instance instanceof $.Origin.Concat.Configuration)) {
197197
throw new Error(`Given observe object doesn't have Concat origin`);
198198
}
199-
this.observe.origin.instance.set().defaults(type);
199+
this.observe.origin.instance.set().type(type);
200200
this.updated().origin();
201201
return this;
202202
}

application/platform/types/observe/origin/concat.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export class Configuration
6666

6767
public set(): {
6868
files(files: string[]): Configuration;
69-
defaults(type: Types.File.FileType): Configuration;
69+
type(type: Types.File.FileType): Configuration;
7070
push(filename: string, type: Types.File.FileType): Configuration;
7171
remove(filename: string): Configuration;
7272
alias(alias?: string): Configuration;
@@ -80,8 +80,11 @@ export class Configuration
8080
);
8181
return this;
8282
},
83-
defaults: (type: Types.File.FileType): Configuration => {
83+
type: (type: Types.File.FileType): Configuration => {
8484
this.defaultFileType = type;
85+
this.configuration.forEach((conf) => {
86+
conf[1] = type;
87+
});
8588
return this;
8689
},
8790
push: (filename: string, type: Types.File.FileType): Configuration => {

0 commit comments

Comments
 (0)