Skip to content

Commit 5fe0cea

Browse files
committed
[cdt-98] - renamed to view command
Signed-off-by: ashish <[email protected]>
1 parent ff57221 commit 5fe0cea

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/commands/showfile.ts renamed to src/commands/view.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import {Command, flags} from '@oclif/command'
44
import Logger from '../utilities/logger'
55
import Utilities from '../utilities/utilities'
66

7-
export default class ShowFile extends Command {
8-
static description = 'File Minifier'
7+
export default class View extends Command {
8+
static description = 'View file content and more'
99

1010
static DEFAULT_COUNT = 10
1111
static flags = {
@@ -18,7 +18,7 @@ export default class ShowFile extends Command {
1818

1919
// required FILE
2020
async run() {
21-
const {args, flags} = this.parse(ShowFile)
21+
const {args, flags} = this.parse(View)
2222

2323
args.file = this.getFilePath(flags, args)
2424
args.num = this.getFileLinesToShow(flags)
@@ -41,7 +41,7 @@ export default class ShowFile extends Command {
4141
if (flags.num && flags.num > 0) // if value available and valid
4242
return flags.num
4343
else
44-
return ShowFile.DEFAULT_COUNT
44+
return View.DEFAULT_COUNT
4545
}
4646
// tslint:disable-next-line:no-unused
4747
private checkParameters(flags: unknown, args: { [p: string]: any }) {

test/commands/showfile.test.ts renamed to test/commands/view.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
import {expect, test} from '@oclif/test'
22

3-
describe('showfile', () => {
3+
describe('view', () => {
44
test
55
.stdout()
6-
.command(['showfile'])
6+
.command(['view'])
77
.exit(0)
88
.it('File path not passed', ctx => {
99
expect(ctx.stdout).to.contain('File path not passed')
1010
})
1111

1212
test
1313
.stdout()
14-
.command(['showfile', 'test/resources/showfile.csv'])
14+
.command(['view', 'test/resources/csv/test_view.csv'])
1515
.it('check 10 lines are found', ctx => {
1616
expect(ctx.stdout).to.contain('|1 |2 |1 |14.0 |30.0708|1 |0 |')
1717
})
1818
test
1919
.stdout()
20-
.command(['showfile', 'test/resources/showfile.csv', '-n', '5'])
20+
.command(['view', 'test/resources/csv/test_view.csv', '-n', '5'])
2121
.it('check 5th line is found', ctx => {
2222
expect(ctx.stdout).to.contain('|0 |3 |0 |35.0|8.05 |0 |0 |')
2323
})
2424

2525
test
2626
.stdout()
27-
.command (['showfile', 'test/resources/showfile.csv', '-n', '900'])
27+
.command (['view', 'test/resources/csv/test_view.csv', '-n', '900'])
2828
.it('check if the given number is greater than total lines', ctx => {
2929
expect(ctx.stdout).to.contain('|0 |3 |0 |32.0 |7.75 |0 |0 |')
3030
})
3131

3232
test
3333
.stdout()
34-
.command(['showfile', 'test/resources/showfile.csv', '-n', '900'])
34+
.command(['view', 'test/resources/csv/test_view.csv', '-n', '900'])
3535
.it('check if 900 count is used, it shows only total present rows', ctx => {
3636
expect(ctx.stdout).to.contain('showing top 892 rows.')
3737
})
3838

3939
test
4040
.stdout()
41-
.command(['showfile', 'test/resources/showfile.csv', '-n', '0'])
41+
.command(['view', 'test/resources/csv/test_view.csv', '-n', '0'])
4242
.it('check if the given number is invalid then show default 10 lines', ctx => {
4343
expect(ctx.stdout).to.contain('|1 |2 |1 |14.0 |30.0708|1 |0 |')
4444
})
File renamed without changes.

0 commit comments

Comments
 (0)