TODO
- Refer README.md
- Look up todo frequently
- Add -n+num and -c+num
- Add -r and -q
- Make extraction from
tailMain
MAYBE
- Consider extracting mapper function inside map
DONE
- Make general parse for both head and tail
- Make throw error for respected function
- Add tail contract in README.md
- Change some regular function to arrow
- Add -n-num and -c-num
- Investigate how
tail
actually works - Move to tail
- Add limit validation
- Add log and error in
headMain
- Add limit validation
- Separate validation to another file
- Refactor
parseArgs
- Take -num count as a parameter
- Implement combination of options invalid
- Added exit code
- Implement
setSeparator
- Implement multiple file names in array
- Investigate how
head
actually works - Moved
parseArgs
to a separate file - Change filename
src/head.js
tosrc/headLib.js
- Implement multiple file name shower
- Connect
formatHead
withheadMain
- Implement -n option
- Implement -c option
- Consider object for -n or -c option
- Added support for multiple files in
headMain
- Connect
parseArgs
withheadMain
- Make changes to functions
split
,join
andslice
lines - Make
head
take options - Take file name as a parameter in outer head.js
- Take default count as a parameter
- Implemented count parameter
- Make
headMain
function work on file - Extract '\n' to a constant
- Separate functions to
split
,join
andslice
lines - Make
head
function work on default 10 - Make
head
function work on file content instead of file - Make
src
andtest
directories - Use an
.eslintrc.json
- Use an
.eslintignore
- Use an
.gitignore
- Verify
mocha
exists - Make an
testHead.js
- Write an expectation/test case
- Make an
head.js
insrc
TODO
- Implement
tailMain
with custom count option for single file - Implement
tailMain
with bytes option for single file - Make
tailMain
work for single file with-n
and-c
option - Write parser for
tail
- Change directory structure from
src/head src/tail test/head test/tail
tosrc
andtest
DONE
- Add
tailMain
- Implement
tailMain
with default option of lines for a single file - Make
tail
work with file content instead of file - Implement
tail
with bytes option with contents of file instead of file - Implement
tail
with lines option with contents of file instead of file - Consider a richer structure for option as an argument to
tail
- Extract a function which will give last n lines
- Move
splitLines
andjoinLines
tostringUtils
- Extract
\n
into a variable - Extract
splitLines
andjoinLines
fromtail
- Write README for
tail
- Make
head
andtail
directories insrc
andtest
- Make
testTailLib.js
intest/tail
directory - Write a test for
testTailLib.js
- Make
tailLib.js
insrc/tail
directory - Make
tail
work for default option of lines with count of 10 with file contents
TODO
- Implement
parseArgs
- Make it work for single file
- Report errors if provided options are invalid
[x] If both
-n
and-c
options are provided [ ] No value provided with option - If no options are given provide default option of count lines with defualt of 10
- Make it work for multiple files
- Options should be parsed independent of order
- Iplement parser for non-spaced options (
-n2
)
DONE
- Change the error message for
can't combine line and byte counts
- Simplify
headMain.js
- Implement
headMain
- Rename
print
- Move mockers to
mockers.js
- Simplify
print.js
- Extract the code of
head.js
intomain
- Make head work for multiple files
- Give the output of head to
print
instead of returning it -
Consider returning a richer structure fromheadMain
headMain
is not returning anything - Make a
print
function which will print the output - Remove
hasMoreArgs
- Report error when unable to read file
- Extract
parseOptions
function fromparseArgs
- Simplify
parseOption
- Test
validateOption
- Test
parseOption
- Refactor
argsIterator
to have a single object - Create
argsIterator.js
- Move iterator code to
argsIterator.js
- Test
argsIterator
- Implement
headMain
with command line option for-c
- Implement
headMain
with command line option for-n
- Make
testParseArgs.js
- Make
parseArgs.js
- Make
head
work for single file without any options - Make
testHeadMain.js
- Test
stringUtils.js
- Imlement
head
with bytes option - Consider a richer structure for option as an argument to head
- Implement
head
with custom count option - Move
splitLines
,joinLines
andNEWLINE
to stringutils.js
- Extract a function which will give required number of lines
- Extract
\n
to a constant - Extract functions to split and join lines
- Make
src
andtest
directory - Verify
mocha
exists - Make
testHeadLib.js
- Write test case
- Make
headLib.js
- Make
head
work for default option of 10 lines without file
Todo:
- Rename
parseArgs
toparseHeadArgs
- Make a common
parseargs
for basic parsing of args ofhead
andtail
- Make
tailMain
take file instead of content
Maybe:
Done:
- Test
parseTailArgs
- Separate
parseTailArgs
to another file - Make
tailMain
function - Change the directory structure
- Remove the
head
andtail
separation
- Remove the
- Extract a function from
tail
- Make
tail
work for bytes (-c) option - Make
tail
function work for count (-n) option- Take the option as an object to the
tail
- Take the option as an object to the
- Make
tail
work for more than 10 lines - Make
tail
work for 10 or less lines - Write test case for tail
- Make
testTail.js
. - Make separate directories for
head
andtail
insrc
andtest
Todo:
Maybe:
Done:
- Return exit code
- Refactor
headMain
- Ectract a function for printing
- Print the output from
headMain
instead ofmain
- Make
headMain
work for multiple files- Add header for each file
- Make
head
work for multiple files - Validate the arguments of
headMain
- Make
getResult
return return error staturn also -[x] Change the structure of the return object - Make
parseArgs
handle combined options - Make
parseArgs
parse-[number]
- Test
getResult
- Move validation functions to separate file
- Make the
parseArgs
show the usage when no file is given - Make
parseArgs
work for multiple files- Take an array for fileNames
- Use iterator in
parseArgs
for arguments - Make
parseArgs
handle options and option arguments together - Validate options
- Validate count of lines and bytes
- Make head.js run from command line
- Make
parseArgs
handle same options multiple times - Test
parseArgs
- Make
parseArgs
- It takes the arguments and returns the parsed arguments
- Make a
headMain
function - It should take
fileReader
andarguments
- Should return the head of the given text
- Make
head
work on file content instade of file - Implement the bytes (-c) option for
head
function - Make
head
function- It takes
text
andoption
as argument and returns the head oftext
based on theoption
-
option
argument is an object havingoption
andoptionArg
as keys
- It takes
- Rename function
head
tocutText
- Take the
seperator
andcount
as object - Change
assert.equal
toassert.strictEqual
in tests - Test
head
for bytes option - Change
splitLines
andjoinLines
tosplitBy
andjoinBy
-
splitBy
andjoinBy
should take the separator as second argument.
-
- Change the contract of
head
function-
head
will taketext
,separator
andcount
as arguments
-
- Consider taking options as object to the
head
function - Extract
splitLines
,joinLines
andnewline
- Change the name of function
cutLines
tocutElements
- Extract a function from
head
for cutting lines - Make
head
function work for count (-n) option - Make
head
function work for more than 10 lines - Make
head
function work for 10 lines or less - Verify
mocha
- Write a test case
- Make
testHead.js
- Make
test
andsrc
directories - Cerate a readme for contract.
TODO :
Tail :
- Make the tail accept file content
- Link the same parseArgs to tail
- Should implement -r option
- Should implement -q option
- Write parse args for option decision
- parse args should handle switches without value
- parse args to parse switches that are provided together
- valid options together : -qn, -cn, -rn, -rc, -qr, -rq, -rqn, -rqc, -qrn, -qrc followed by count
- option obj from parse args should give true or false for reverse and format off
- reverse should work based on new lines
- quiet should decide whether to call formatter or not
- parse args to take options and have object for each flag
- flags it can be combined with
- if it expects a value after it or not
- [ ]
Head :
MAYBE :
Head :
Tail :
- Consider implementing iterator
DONE :
Tail :
- Implement the parseArgs for initial case
- Make a function to decide the count to be given
- Receive fileReader in the main function
- Create tailMain to pass options as object
- Use function references and decide the option behaviour
- Pass count from main function
- Give line count as variable to tail
- Change the logic of tail for slice to take negative start point
- Implement tail for default case (10 as default)
- Implement tail for content with lines less than 10
- Parameterize tail to accept content as variable
- Try keeping a fixed return value
- Create tailLib.js
- Create testTailLib.js
Head :
- Modified the validateInvalidCombo function
- Change the for loop to while in parseArgs
- Extracted the formatContent function
- For illegal option give usage
- Remove the format file
- Handle the single file case
- Make it differentiate between error and output streams
- Write the print function to print the output to the screen
- Make mock functions for console(error and log)
- Separate the tests of utilities from testParseArgs
- Separate utility functions from parseArgs
- Change fileName to fileNames
- Separate the validations and parse
- Check for invalid count
- Separate functions that are formatting to a separate file
- Only number succeeded by a hyphen is passed
- parseArgs to validate more conditions
- Check for multiple options being given
- Accept options even if there is no space between switch and count
- Check for wrong option being passed
- Check if both -c and -n switches are used together
- If same switch is used multiple times the predecessor is overridden by the successor
- Change the parseArgs to format the args before looping
- Implement head on multiple files
- Remove the separateSwitchAndValue function
-
Use regular expression to find out where the files start from - Maintain all the files in an array
- Get all the files given to the head
- Wrap readFileSync in a try catch block
- Extract delimiter selection from headMain
- Make head work for the string at first˝
- Make parseArgs accept user provided options
- Make decision on the delimiter based on the option in headMain
- Write a main function for head which maintains defaults
- Add a parseArgs function initialized with default values
- Make the headMain function to take read function
- Create a main function
- Rename lineCount -> count, extractPortion -> sliceUpto
- Implement the bytesCount option -c
- Head to receive a delimiter
- Parameterize the delimiter for joinLines and splitLines functions
- Implement the lineCount option -n
- Parameterize the number of lines option
- Can make a file for the utilities
- Check for empty data being passed to head
- Extract a function from the head function(slice)
- Head function needs to have the default of 10 lines
- Implement head to give back all the content when content is less than 10 lines
- Parameterize the content in the head function
- Add test case for a hardcoded value
- Add headLib.js to the src directory
- Create a testHeadLib.js
- Create the directory structure src and test
TODO:
- Implement -q option
- Improve compile function
- Move
testParseArgs.js
to test/ - Implement tailMain
- Handle
head.js -n1 -c1 -v1 file
- Work on idea of Chained parser
- Put common variables to same file
- list of stand alone options and valid optoins
MAYBE:
- Make mocker resetable
- Change the contract of
linesStartingAt
andlastNLines
- Move common libraries outside of head
- Change passing multiple array to mockers to passing array of objects
- Move
mockers.js
to test from src
PROBLEMS:
DONE:
- Handle
tail.js -n1 -n2
- Add validation for repeating args
- Handle
tail.js +2
- Tests for error throw in tailArgs and headArgs
- Tests for createParser
- Tests for optionParsers
- Make createParser working for head
- Make createParser working for tail
- Config for createParser
- How to send operations to createParser in config ?
- Implement
--help
- Make it working for multiple files
- Implement stderr messages for tail
- Enable cli arguments to tail
- Implement
tailArgsParser
- Make tail validator
- Implement tail options compiler
- parseArgs should only return parsed arguments. It should not compile them
- Put parseArgs.js to src
- Create headParseArgs
- Make parser to handle option value with signs
- Pass validator to the parseArgs
- Make it working for -n with option value without sign (eg, 1, 2, etc)
- Make it working for -c with option value without sign (eg, 1, 2, etc)
-
Implement tail operator selector,tailOperator
- Implement
bytesFrom
- Implement
linesFrom
- Implement
bytesStartingAt
- Implement
linesStartingAt
- Implement
tail
function - Implement
lastNBytes
function - Implement
lastNLines
function - Establish the contract for
tail
-
Consider change contract of firstNLines and pass content as string -
Change the test description of firstNLines, changeget
togive
-
Remove magic number lint errors from firstNLines and nBytesFrom -
CorrectnByesFrom
in contracts.md -
head file
gives 1 line if the file is empty - Separate
headLib.js
tests to new test files- headMain
- headFiles
- Investigate on the output of origial
head
andhead.js
- Rename file name
stuoutHandler.js
tostdoutHandler.js
- Handle
Option requires an argument
- Handle
head.js -1
- Add underscore in every error code
- stdout message generator
- Handle if no argument is provided to option
- Handle
head.js
with no args - Test all the helping functions
- Rework on parser with loop using iterator
- showHeader can be a function
- Change assertNoFile to assertFile
- Update sidenote from README.md of providing both options
- Validate parsed arguments
- Validate files
- Validate options
- Validate options values
- Handle
head -nc0 head.js
- Implement
head --help
- Handle no file provided
- Make it working for multilpe files
-
Implemented headFiles function - Option validator is not working of invalid option value
- Value should be a number
- Validate throw object should have code
- Compile parsed options to domain options
- Only one option is given at a time
- Provide argument to
headMain
- Options separated by their values
- Options not separated by their values
- Implement -n option from cli
- Implement -c option from cli
- 0 bytes case should be handled. On shell, it gives error
- Set default option in parseArgs
- Move validators to separate lib
- Compile options while parsing
- Test validateOption
- Implement parseArgs
- Parse files when options with separated values given alongwith
- Parse files when options with their valus given alongwith
- Parse options separated with their values
- Parse options with their values
- Provide args to
head.js
- Implement
head file
for single file - Implement
head
working for getting bytes from the content - Consider giving option as object to head()
- Add a function contracts file
- Pass
lines
first and thencount
to firstNLines - Implement nBytesFrom function
- Test stringUtils.js functions
- splitLines
- joinLines
- Move splitLines, joinLines and SEPARATOR to new lib
- Implement splitLines function
- Implement joinLines function
- Implement head function
- Implement firstNLines function
- Create directory structure
Do:
- Refactor firstNLines function.
- Refactor parseArgs.
- Implement -q option
- Implement tailMain. Maybe:
Done:
- Write a function to determine operation
- Implement -r option
- Create contract for tail.
- Make reverseContent work for more than two line.
- Investigate how tail works
- create directory structure
- Make reverseContent work for a line.
- Implement -c option
- Make lastNCharacter function work for last two character.
- Make lastNCharacter function work for more than two characters.
- Implement -n option
- Make tail work for default behaviour.
- Put lastNLines function into separate file.
- Implement lastNLines function in test file.
- make lastNLines function work for more than two lines
- make lastNLines function work for a line.
- Removed regular expressions.
- Refactor isOptionInvalid.
- add exitCode .
- Make head work for more than one file.
- Change error message when both arguments are not present.
- Change error message in findFiles.
- Modify validate arguments.
- change contract of structureOption.
- modify findFile.
- Report error if arguments are invalid.
- separate testcases.
- modify structure of output of parseArgs
- Refactor structureOption function.
- Report error if file not found.
- Refactor parseArgs
- Implement main.
- Display usage if argument not specified.
- Make head work for a file
- Implement -c options.
- Make head work for text instead of reading input from file.
- change contract of firstNLines function.
- take arguments in object.
- change contract of helper functions.
- write parseArgs function to parse argument.
- Establish contract for head.
- Create synopsis in README.
- Investigate how head works.
- Make 'src' and 'test' directory.
- Create test file in test directory.
- Write testcase and write a function in test file.
- Create headLib.js
- Add code into headLib.js
- Make firstNLines work for default behaviour (Give first 10 lines).
- consider array instead of string.
- Write string functions for split and join lines.
- test splitLines.
- test joinLines.
- Separate helper functions in different file.
- Extract function for take out first lines from array.
- Implement -n options.
- Extract '\n' to a constant.
TODO FOR TAIL
- Make tail to give last 10 lines.
DONE OF TAIL
- Implement tail that gives single line.
- Implement tail that gives multiple lines.
TODO FOR HEAD
- Send output in two different streams
- Standard output stream.
- Standard error stream.
Done OF HEAD
- When multiple files are passed, if any file is not present, that should throw error, and other files should get executed normally.
- Modify the return structure of parseArgs.
- Override options, when same option is passed multiple times.
- Move parse time errors(option and count related errors) to parseArgs.
- Refactor parseArgs.
- Give scalable logic in asssertValidInput.
- Refactor 'headMain' function in headLib.js.
- Refactor head function in 'headLib.js'.
-
After doing 'head', does last line has '\n' as last character? - Check the functionality of head once.
- Consider rich structure for 'head'.
- Write validations for options.
- Count should be positive.
- Either '-n' or '-c', only single option can be given.
- Test validations.
- Extract each error into its own function in assertValidInput.
- Modify the input data structure of formatFileContent- from objects to array of objects.
- Modify the input data structure of formatFileContent- from arrays to objects.
- Give the responsibility of decision making to head, about which data to send back based on option.
- Test validateInput.
- Add few cases in parseArgs where
- count is concatinated with option.
- option and count are passed as -count.
- Move validation from parseArgs to headLib.
- Format the output when multiple files are passed as input.
- Move 'headMain' tests to different file.
- Wire parseArgs to headLib.js
- Modify the contract of head.
- Implement parseArgs.
- When only one file is passed.
- When only one option with any number of files is passed.
- When no option is provided with multiple files.
-
Files can be [^-*0-9]
- Consider 'head', when no options are passed.
- Implement '-c' option.
- Implement '-n' option.
- Take options as object.
- Create main in 'headLib.js'.
- Write main.
- Take file from command line.
-
Create a data file. - Extract split and join into different functions.
- Take a constant variable for '\n'.
- Work on content, don't consider file.
- Implement 'head' that gives first 10 lines of the content. (default behaviour of head).
- If the content is less than or equal to 10 lines, should display whole content.
- Create 'src' and 'test' directories.
-
Copy eslint.json. - Check whether mocha is present.
- Create 'testHead.js'.
- Write a test case.
- Implement 'head file'.
- After passing the first test case, create 'head.js' and move the logic there.
TODO
TAIL
- Implement tail with file
- Test createIterator
- Make parser generic
- Investigate tail command
HEAD
- Do not assert in mocked log
- Separate mockers in another file
- Refactor print
- Refactor parseArgs
- Refactor headMain
- Investigate head command.
- Validate arguments
MAYBE
- Consider making head and tail directories inside src and test
- Consider test for empty file.
- Consider separation of validation and parsing of args
DONE
TAIL
- Parse Args for tail
- Implement splitArgs
- Make tail work on content first
- Make tailLib and testTailLib
- Establish contract for tail command
HEAD
- Test headMain function
- Test headFile function
- Change name of function
fileResult
- Handle multiple files
- Change the contract of headMain
- Test thrown errors.
- Validate if no files are provided.
- Change variable name
optionArg
tocount
andoptionName
toflag
. - Validate arguments for files and single option without space
- Validate arguments for files and numeric option
- Validate count, should throw error if count is 0
- Format the output for multiple files.
- Display usage of head only on invalid use.
- Display thrown errors.
- Extract function out of parseArgs.
- Validate arguments for files and single option repeated multiple times, separated with space
- Validate arguments for files and single option, separated with space
- Validate arguments only for files
- Implement head for multiple files.
- Display filename along with showing error.
- Deal with file not found error.
- Change the contract in head.js
- Delegate the task of deciding separator to head instead of headMain.
- Refactor headMain
- Change the structure of parsedArguments in parseArgs function.
- Delegate the task of deciding separator to headMain instead of parseArgs
- Pass args consisting of files and option to headMain.
- Parse arguments consisting of option and file.
- Parse args without any option.
-
Delegate the task of splitting and joining of lines to another function. - Test headMain
- Implement head with single file without options
- Change name of extractContent function.
- Implement bytes option on head(-c).
- Find common variable name which will work for both count and bytes.
- Pass separator in the options object.
- Use object structure for options.
- Change contract of head function.
- Extract the task of getting first n lines from head function.
- Give default count for head.
- Implement count option on head(-n).
- Implement head with content instead of file.
- Display whole content rather than having default count of lines.
- Make headLib.js and testHeadLib.js files.
- Verify mocha.
- Create directory structure.
- Discard --help option.
TODO :
- make testTail.js and tail.js
- implement
tail file
MAYBE :
DONE :
TODO :
- refactor fetchOptions
MAYBE :
- consider an edge case of traling newlines
DONE :
- make
src
andtest
directories - make
testHead.js
- write a test case for head
- make head work on provided content instead of file
- make head work for 1 line content
- make head work for content less than default count
- make default count 2
- make
head.js
src directory - make head work for variable line count
- consider extracting spliting and joining of lines to functions
- refactor head
- set default count to 10
- test firstNLines
- implement first bytes -c
- refactor head
- think for a better way of choosing option
- test countByLines function
- consider extracting count and byte to new functions
- consider a richer structure of handling data
- set default count in head instead of countByLines
- make a headMain function
- rename
src/head.js
tosrc/headLib.js
- implementation and testing of parseArgs are in half way
- make parseArgs accept multiple files
- refactor parseArgs
- test parseWithOption and defaultOption
- make parseArgs over write options
- introduced parsing in headMain
- make head work for options with and without space;
- implement parseArgs function
- read commandline arguments in head.js
- make testValidate.js
- validate options
- give appropriate error message
- give error in error strem
- make head to work for multiple files
- make headMain.js and testHeadMain.js
TODO:
- Implement
tail file
without options. - Provide default for options of
tail
. - Keep
usage
for without options.
MAYBE:
DONE:
-
head.js
- Establish contract for
head
utility. - Make correct directory structure.
- Verify
mocha
exists. - Make
testHead.js
. - Start with an expectation.
- Make
head
work for a single line instead of file. - Create
headLib
in src and keephead.js
in root of working project. - Make
head
work for two lines. - Make
head
work for empty line. - Investigate how options work for
head
. - Implement options as a parameter to
head
. - Implement a different contract for functions in Lib.
- Implement different function for split and join lines.
- Extracted
\n
to a constant. - Implement options as an object.
- Implement
head
with count (-n) option. - Separate test files for line utilities.
- Introduce
head.js
, that runs from command line. - Implement
head file
without options. - Implement function for
.slice()
. - Implement --help if no argument passed to
head.js
. - Implement
head
with bytes (-c) option. - Extract separator and option selection in different function.
- Implement
-n
as an command line argument. - Change the contract of Main.
- Provide default for options of
head
. - Parse arguments passed to main.
- Implement
-c
as an command line argument. - Add try catch block for readfile.
- Report error when unable to read file.
- Consider different structure for functions.
- Report error when both switches provided.
- Changed option name from count to lines.
- Provide a default of 10 for -n option.
- Make
head
for repeating same option. - Refactoring parsing arguments for both
-n 5
and-n5
. - Change the contract of selector for given object.
- Make
head
work for multiple files. - Test intermediate functions.
- Implement function for output structure.
- Report usage for invalid option and without file name.
- Report error for invalid values to option.
- Create Validation functions for options ans values.
- Create exit code for errors.
- Establish contract for
-
tail.js
- Establish contract for
tail
utility. - Make
testTail.js
. - Start with an expectation.
- Make
tail
work for a single line instead of file. - Make
tail
work for multiple lines and empty line. - Implement option as a parameter to
tail
. - Investigate how
tail
works with options. - Implement
tail
with lines(-n) option. - Implement
tail
with bytes(-c) option. - Extract different functions for lines and bytes.
WORKING:
- Refactor
parseArgs
.
TODO:
HEAD:
- Refactor
headMain
. - Test multiple files.
- Write tests for
headFile
. - Write tests for
validators
.
TAIL:
- Use differnet parser in tail.
- Send
formatArgs
toparseArgs
. - Implement
formatArgs
. - Set the default of -n to 10. MAYBE:*
MUST:
- Review code after function becomes 4 lines.
- First hardcode the values.
- Dont write code when i dont have clarity.
DONE:
- Extract functions from
parseOptions
. - Write tests for
tailFile
. - Write tests for
tailMain
. -
tailMain
should takelog,error
. - Write
tailMain
function. - Add
main
in tail.js. - Implement multiple files.
- Send
parseOptions
toparseArgs
fromtailMain
. - Write try catch in
tail.js
. - Write
try catch
in tailMain. - Change the contract of
tailMain
to recieve args. - Extract data into seperate file.
- Pass
readFile
totailMain
. - Change the directory structure.
- Send usage when no
options,files
specified. - Write a sample test for tail.
- Write function for lines .
- Write function for chars.
- Refactor
validateArgs
. - Change the contract of
headMain
to takelog,error,readFile,args
. - Change the formatter to take content and format it.
- Write print in a seperate file.
- Store content and
isError
for printing. - Send mocked log and error functions to print.
- Use print function to display output and errors.
- Handle if
-10
comes. - Throw error if
0
is a value. - Write tests for validateFiles.
- validate the files in
validateArgs
- Change the error message in
validateArgs
. - Use forEach in
validateArgs
- validate in
parseArgs
only. - set -n when no option is specified.
- validate the object recieving from
parseArgs
- Change the validateArgs function.
- Extract validateArgs into a different file.
- Extract
parseOption
function from parseArgs. - Change the tests of
parseArgs
- Consider changing the contract of
parseargs
to send all the options and then validate. - Remove isOption function.
- test
seperateNameValue
function. - Test
seperateArgs
. - Create the iterator in different file.
- Consider the iterator method.
- Change the mock function to work on multiple files.
- Show usage when no files specified.
- change the test cases for head main(send arrays).
- Change the
format
in multiple files test case. - connect formatter in headMain.
- write a formatter.
- format differntly when one one file is given.
- write formatter in a differnet file.
- use map for multiple files.
- Make head accept multiple files.
- Throw error if files are not specified.
- Send errors to std error.
- export
splitlines
andjoinlines
. - Throw error if 2 different options are specified.
- Make
parseArgs
work when options are without space. - Use regex in parseArgs.
- Throw an error when option is invalid.
- Change the
headmain
to throw usage. - Change the
message
to usage. - Go until options are triggered, consider all the file names after that option.
- Add tests for
isOption
- Check the options are valid.
- Make parseArgs work when same option is repeated.
- Go through the args array and find which is options and files.
- Change the structure of object to
name count filenames
- Change the
optionName
toname
. - Add try catch in
main
. - Write assert throws when file not found.
- Write a try catch in
headMain
. - Dont work on files at start instead work on content of file.
- Add main in
head.js
. - Make head work for one file.
- Change the contract of
head
to take variables. - Decide the seperator in
headMain
. - Create a headMain that deals with files.
- Make a richer structure while parsing.
- Change the
extractLines
funtion name. - Change the contract of
parseArgs
to return without separator. - while parsing
args
decide the separator. - Set
number of lines
to 10 , when options are not specified. - Make
parseArgs
work for-c
option. - Make
parseArgs
work when one option is given. - Create separate file for
parseArgs
. - Change the contract of
head
to take separator. - Send a separator to
splitLines
andjoinLines
. - Move
splitLine
andjoinLines
to new file. - Add tests for
splitLine
andjoinLines
. - Pass the number of lines to
head
function. - Write
splitLines
andjoinLines
function. - Create head function that takes contents and work on it.
- Create a function which takes lines and number of lines to return.
- Use slice to get lines.
- Make an expectation/test.
- Create testHeadLib.js, headLib.js.
- Create a directory structure.
TODO
- large file
IDEAS
- Move string ultil functions into another files
- what if -n or -c is zero?
DONE
- added option values count to the pasingData object
- created a file for parsing head. parse is generic and separate file.
- validation will be separated
- remove validation from
readFileContent
- remove validation from
- -1
- Validation
- -n, -c should not be together
- after switch, there should be a integer value
- -1 is possible
- error from error stream only
- main will call function to display output or error
- store file read error in object
- read file error
- deafult
- validation
- Provide a
help
message - help
- write a formatter to format the output for multiple files
- Make
head
work values given by user from cmd-line - Write
main
connect with lib - added parser in headMain
- write
parser
-
headMain
can take multiple file in argument -
head
can take one file in argument - in
head
function,content
will be changed to file paths - separate -n and -c logic
-
head
can takecharCount
in argument - modified string functions to get lines or charecters
-
function to get first N charecters -
head
can takenumOfLines
in argument - Implement
head
for hard coded content - Extract the logic to cut the content
- hard code 3 as deafult
numOfLines
-
head
works on multi line content -
head
only works on one line content - Make directory structure and add/arrange necessary files.
- check
mocha
,eslint
present in the working directory
TODO
- Implement
tail file
- write tailMain to take file from command line without options
- Make
tail
work for file content instead of file - Parse command line arguments
- Consider options as object
- Refactor parseArgs
- Test small functions of parseArgs.js
DONE
- Change directory structure
- Refactor tail
- Implement
-c bytes
option - Implement
-n +N
option - Implement
-n lines
option - Use stringUtils file
- Implement
tail
to work on multiline string - Implement
tail
to work on provided string first - Write an expectation/test case for
tail
- Start tail.js
- Restructure the directory structure
- Add
tail
in README.md -
Consider breaking down tests in different filebroke into small functions and tested - Test small functions of headLib.js
- Change headMain to show content and error in differet stream
- Test console statement in headMain
- Introduce exit code
- Show errors in error stream
- Implement
-n
option as-1
- Implement head to display multiple files
- Consider how to manage when provided byte and numOfLine are 0
- Validate the given options
- Be explicit about which function to call in head
- Change the way of parsing
- Show usage for wrong arguments
- Manage error when -c and -n both options are provided
- Consider when no file is provided
- Implement head to take command line option -n
- Implement head to take command line option -c
- Parse command line arguments
- Implement
head file
- Connect
head
with command line - Consider changing file name of head.js in src
- write headMain to take file from command line without options
- Implement
head
to work on file content instead of file - Move slice to stringUtils
- Extract common part of firstNLines and firstNChars
- Consider moving splitLines, joinLines and NEWLINES to another file
- Implement
-c bytes
option - Consider options as object
- Test firstNLines function
- Refactor head
- Implement
-n lines
option - Extract split and join
- Extract '\n' to a constant
- Implement
head
to work on multiline string - Implement
head
to return 10 lines forhead string
- Implement
head
to work on provided string first - Write an expectation/test case
- Make
src
andtest
directory structure
- remove the repeated code in parser MAYBE
- consider generic parser
Done
- implement for +0 case
- implement -r option
- implement -q option
- cover the tail -2 file.txt case
- cover the tail +2 file.txt case
- check if new contract can be handled using existing parser
- implement tail main
- check the parser
- modify the validaters for tail
- take the arguments from command prompt
- use the print function from head
- make tail works for explicitly for single line if given data contains more than 1 line
- write test for more than one line.
- extract tail function from test in to src/tailSrc
- create file of testTailLib.js in test/tailTest/
- write expectation
- take the contract from tail command from shell
- experiment tail in shell
- change the directory structure
- make sure every test is passing
TODO
- check for --help is not working properly
- refactor parseArgs
- duplicate mock functions
- seperate mock functions into seperate file Things to be in consideration in mind
- follow
TODO
. - Refactor code in every cycle.
- work on hard code data .
DONE
- test console.error in head main function
- write seperate function for error and log
- extract into print function seperate file
- add tests for headMain
- remove the messy from parseValueAndFile function
- consider by taking all the files after one file found
- extract validation into separate file
- write tests for headMain in headLib.js if more then one file is given
- implement the console.error
- throw the related errors for certain validations
- should works for -1 as option
- consider
node head.js -1 -c1 a.txt
should throw an error - consider more then one file or single file.
- change the contract of parse args and head
- refactor the parse and validation
- remove the complexity from parse args
- seperate validation from parse args
- do validation of options
- extract joinLines and splitLines into new file.
- write test for extract function
- write test for getSeparator
- remove the references from head
- think about head function test that reference is taking or not
- write a parser that will take arguments nad gives structured parameters
- consider default case.
- add more test to head
- run the noOfLines option from head.js
- use option for no of lines
- use option for no of characters
- implement head.js to use from command line
- change the contracts of lines and characters
- think about data structure. are Arrays ok or should i need to change
- should i need to change the name of headMain . think in a break
- use the lines and characters function from top level
- extract joinLines and splitLines in to separate functions
- refactor filter with slice
- use parameter for no of characters
- add character function
- change the file names from
headMain
toheadLib
-
extract filter from headMain function - change the headMain to lines function
- write test for more than one line.
- make head works for explicitly for single line if given data contains more than 1 line
-
consider extension for head contract changing to nl contract - extract the headMain function in newFile.
- write expectation for test.
- create testHeadMain.js.
- check mocha is working or not.
- make directory structure.
- write validators for tail args
- validate the arguments
- write parse option for tail
- throw errors
- catch errors and console error messages
- implement main to be injected with dependencies
NOTE
- follow the todo
- break complex code
- errors to be thrown via error stream
- error changes the exit status of process (1)
- create a tailLib
- core fns
- test core fns
- handle case of ++100 file
- make
separateOptions fn
regex to support ++100 as not a option
- make
- make parse option to handle
+10
implies-n +10
- handle case tail +n1 '+n1 taken as file'
- separate args to support +, - signs of values
- write Todo
- take detailed note of tail contract
- separate arguments as of head
- ( using head arg parser )
- has to solve error throw of head.js -na, asking arg
- extract data manipulation into a different file.
- make validation generic / extensible
NOTE
- follow the todo
- break complex code
- change approach based on process written.
- Test main with mocking
- errors to be thrown via error stream
- error changes the exit status of process (1)
- implement main to be injected with dependencies
- parse and validate options
- implement head to work on file content and options provided
- implement main to work through command line
- validate inputs function to validate all inputs
- throw error for invalid count
- throw error for invalid option
- throw error for option combination use
- implement options to head (-n, -c)
- change approach to head content
- implement header for head output
- write the separate args function
- write a parser function to handle options
- options at case '-n8'
- options at case '-n', '8'
- options at case '-8'
-
use match instead of regex test -
change approach of passing separator. - errors to be handled
- when file doesn't exits ,
No such file or directory
- when files exist and doesn't (mix),
No such file or directory + 'OUTPUT'
- when unknown option provided,
usage: head [-n lines | -c bytes] [file ...]
- when file doesn't exits ,
- accept arguments without space
- console.error error messages
- change approach of validation inside parsing
- use splice to fetch options passed as args
- add combination key throw (-c and -n)
- add illegal count throw from parser
- when count < 1 ,
illegal line count -- XX
- when option provided is unknown,
illegal option -- x
;usage: head [-n lines | -c bytes] [file ...]
- when -n, -c both used,
can't combine line and byte counts
- when option provided is unknown,
- log
usage
when args not provided - throw error when -c and -n are used
- print File names when multiple files are given
- write a format output fn
- test format name
- test format output
- chain head with files parser and files
- head with file
- test headMain
- Head with options
- Make head to return 10 lines by default
- extract data manipulation functions to different file
- change the name of head.js in src
- Take options as object and then pass to head
-
extract '\n' to const - Make parse options
- test parseArgs
- test parseOptions
- test isOption
- head to pass lineCount, separator
- head to return lines of line count(-n)
- basic head with default lineCount
- separate string manipulate fns
- test string manipulate
- change contract of head fn to receive object
- Implement head for bytes (-c)
- change contract of head to accept separator
- Return number of lines given (given lines it has to return given number of lines)
- Provide number of lines as arg
- Create a fn which will return lines of given count ( first n lines)
- create a fn to join lines
- Implement separateLine to take content and return lines
- convert string data to workable data structure
- create a simple head and start with data
- get head to work for given lines of data
- extract fn into src dir
- test for given content to be returned
- create Dir Structure
- create testHead.js
TODO:
- Make tail work for
content
instead offiles
- Make tail work without options
- Test
lastNLines
MAY BE:
- Investigate how
tail
works
DONE:TAIL
- Create
tailLib.js
andtestTailLib.js
- Make tail work for
single line
- Extract lastNLines from tail
-
tail
dir structure - Get the contract of tail
DONE:HEAD
-
Extract parseOptions from parseArgs - Implement parser for non-space options
-n1,-c1,-1
- change option name
count
tolines
- check if option value is 0 or not.
- Implement parser
- Structure the data
- Parse the data
- Validate the parsed data
-
Validate args before parsing- arrange the options
- validate options(like:both present,invalid,invalid value )
- Implement for multiple files
head options file...
- Implement formatter for multiple files
- handle --help
- Test
validateOptions
function - Refactor
parseArgs
- Implement head for
--help
- Implement try catch in
head.js
- Implement parser for user input
- single file
- single option
- multiple options(same option multiple times, Invalid)
- multiple files
- file validation in headMain
- Change the contract of
head
function - Change return structure of parser
- Take the input from command line
- Implement
headMain
- Implement
head file
- Link
parseArgs
andhead
- Seperate test files
-
Move lines functionality into another file - Refactor
head
- Make
head
works for content instead of files - Make
head
to take options - Make
head
work for -c option - Consider getLines takes content and count and give back specified lines.
- Consider options structure for
head
- Change the inputs order of
head
- Make
head
work for count option (-n) - Refactor
getLines
- Make
head
work without any options - Extract
split
,join
into new functions and into new file - Make
head
to take content - Test
getLines
function - Refactor
head
function - Extract
lines
functionality fromhead
- Implement
head
which gives 10 lines if content is more than 10 lines - Consider data structure of content in
head
function - Make test works for multi-line content
- Make test that works for
single line
- Create headLib.js
- Verify mocha
- src/ test/ directory structure
TODO
- Make parser work for multi occurrence of same option
- Implement tailMain function
- Take file from command line
- Implement -q option
DONE
- Started Implementing generic parser
- Add new requirement for tail in README.md
- Extract function for slice byte from tail
- Implement byte option (-c)
- Use richer structure for passing option
- Extract line function in different file
- Implement -n option
- Make tail works for multiple lines
- Start with tail function
- Create dir structure
- Add contract in README.md file
TODO
- Add test for function option
- Extract head call in a function from headMain
- Add format output function
MAYBE
- Consider alternate contract for parse function
- Consider alternative for slice in head function
DONE
- Add test for fileReader function
- Remove regex from splitArgs
- Change dir structure for head
- Move validation in separate file
- Add new line in print function
- Set -n option when only value is given in splitArgs function
- Extract both the if in function from parser
- First find the option in parser
- Move all validation in validateOption function
- Connect validate option with parser
- Add validate option function
- Make parser function works for switch and value combine
- Add a format args function
- Add print output function
- Add usage option
- Add test for function fileList
-
Change the switch name - Implement headMain for multiple files
- Change contract of headMain for multiple files
- Add functionality for multiple files in parsing
- Remove magic number in head function
- Make mocker works for multiple files
- Change message when reader can't read file
- Change contract of parser
- Extract function for options and fileList from parser
- Consider by-default options
- Connect parser with main
- Make parser function deal with both options together
- Use try catch in headMain
- Extract function for bytes character
- Change name of function sliceFromStart
- Abstract line and character option in headMain
- Make parser works for -c option
- Add parser function
- Take input from command line without option
- Change headMain function default contract to 10 line
- Change switch name
- Add test for splitLines and joinLines function
- Move function spliceFromStart to stringUtils.js
- Change structure for option object
- Implement -c option
- Investigate about -c option
- Use richer structure for parsing data in head function
- Consider test file separation
- Add lib main without any option
- Move string function in different library
- Add test for extractLines function
- Extract logical part in a function
- Investigate -n option properly (eg. line count is 0)
- Extract function split and join
- Implement line limit in head
- Update README with option --help
- Implement head for
multiple lines
- Use strictEqual instead of deepEqual
- Implement head for only
single line
- Start with content
- Decide contract format for Single line
- Create
dir
structure - Check the existence of
mocha
- Create
readme
file
TODO
- make 10 as default for linesCount
- make a function that can choose based on given flag
- make tail main without fs
- handle with single file
head
- fix main of head.js
MAYBE
- Consider changing linesUpto function in tail
- Consider changing charactersUpto function in tail
DONE
- make tail accept charactersCount
- Think about the options of the object
- come up with options object.
- make tail accepts option object which contains files and option and value
- introduce charactersUpto function
- Reinvestigate tail for the new properties
- update the new contract of tail in README.md
- make tail accept linesCount.
- Introduce linesUpto function where it takes linesCount (-n)
- Make tail to give upto 10 lines from last
- introduce split and join lines
- Create directory structure for tail in src and test
- make a tailLib and testTailLib
- Start with no files and no options.
- Update README.md for tail synopsis
___ Head Pending__
- Send the error through error stream in headLib.js
- log the headFiles instead of returning the string
- test main for logs and reading
- Move head main to separate file
-
Refactor the parse function - Consider separating the tests.
-
Consider moving the split and join to stringUtils.js - move the parse sub functions to separate files.
- Test sub functions in parseOptions
- Implement parseOptions
- Make functions for error messages.
- fix iterating over null in parse when option only specified (head -n )
- Validate after parse
- Report if no value given with option
- Report if both options given
- Report if wrong option given
- Report if no count is given
- Implement
--help
option - Return the error message instead of throwing errors.
- head --help
- no count is gven
- Bad file given
- -n and -c are given (invalid option)
- Move the validations in parse to validators file.
- Write main file and test main
- make the default values in main.
- need to parse the option (if accepts)
- make it work for multiple files.
- Change the parser to loop from regex.
- Change the head contract to accept the option.
-
Consider different approach instead of deciding actions using ternary. -
Consider changing name ofactionToPerform
- Think about how to accept options.
- Implement the command line interface
- Implement
head -c characters
- Change the contract of
linesUpTo
by taking the content itself - Implement options using object
- Consider is 'getLines' a good function name?
- Consider changing
linesToShow
variable name. - Refactor head .
- Extracted the for loop
- Consider alternative for
for
loop
- Implement
head -n lineCount
- Implement
head without options
- Implement head for a single line.
- Implement head for 2 lines.
- Implement head up to 10 lines as default.
- Make a plan
- Make the directory structure of src and test
- Verify mocha existence
- Reinvestigate
head
for any leftOut information - Check if the master branch is the one taking commits.
- Make tailMain function
- Implement parseArgs function for tail
- Create todo for tail
- Establish contract for tail
- Seperate dir for tail
- Create a testTailLib.js file
- Write a test case
- Create tailLib.js file
- Implement tail for more than one line
- Pass limit as an argument to tail function
- Make tailContentByLine function
- Consider tailContentByLine work on array
- Implement option as a parameter to tail
- Separate functions to split and join lines
- Pass option name along with limit
- Pass both -num and +num as limit to tail
- Move splitLines and joinLines to a seperate file
- Make tailContentByBytes function
- Improve parseArgs function
- Make src and test directories
- Verify mocha
- Make testHeadLib.js file
- Write a test case
- Make headLib.js file
- Work on file content instead of file
- Implement head for empty line
- Assume head display maximum only first 2 lines instead of 10 lines
- Separate functions to split and join lines
- Make headContent function
- consider headContent function takes array and return array
- Pass range as a argument to head and headContent function
- Implement option as parameter to head
- Investigate -c option of head
- head function takes count option
- head function takes bytes option
- Changed function name headContent to headContentByCount
- Make headContentByBytes function
- Make headMain function
- Implement parseArgs function
- Implement count option for head (-n)
- Implement bytes option for head (-c)
- Seperate test file for headMain
- Change default behaviour of head to display first 10 lines
- Implement report when unable to read file
- Implement head -n for file from command line
- Implement head -c for file from command line
- Throw error for combine option
- Use console.error
- Validation check for arguments
- Invalid option
- Option without value or illegal value
- Throw error when option value is a negative number or zero
- head command work for more than one file
- Throw error for bad file when multiple files given
- Throw error when invalid option given with -n and -c options
- Extract formatHeadContent from printHeadContent
- Write tests for printHeadContent
- Extract getOptionValue function from parseArgs
- Refactor headMain
- Return exitCode from headMain
- Extract isMultipleFile from headContent
TODO
- make
reverseContent
work. - make
noFormatting
work. - make
compileOptions
. - add validators for all flags in parseTail.
- extract throw out
parseHyphen
to validate function and pass it as part of allOption. - create a closure for
parseLines
andparseCount
.
MAYBE
DONE
- Implement
splitBy
andjoinBy
. - Make
src
andtest
directories. - Make
testHeadLib.js
- Write expectation for
extractData
- Write
extractData
- Make
headLib.js
-
extractData
should give the whole array back if length is less than 10. - Make
extractData
work for any given array. - Add test for
splitBy
andjoinBy
. - Implement
head
to work for content not file. - Implement
extractData
to accept count. - Implement
headMain
(It should take the file and pass the content tohead
). - make
head fileName
work. - Implement
head
to work with count. - Implement
splitBy
to take a separator. - Implement
joinBy
to take a connector. - Separate test for headMain.
- Implement
head
to take a separator. - change contract of
head
to accept options. - change contract of headMain to accept cl options.
- hookup parseArgs with headMain.
- surround read file with try catch.
-
Consider changing the name ofextractData
toextractLines
- Refactor parseArgs.
- Move decision of assigning separator from parseArgs to head.
- change contract of headMain to accept fileName as array.
- Implement
getFiles
in parseArgs. -
ImplementgetOptions
in parseArgs using while loop. - Implement
isOption
- Implement
parseArgs
to give the last option if multiple options are given - move get options inside parseArgs.
- get rid of all unnecessary functions in
parseArgs
. - change contract of parseArgs to return all option objects.
- Implement
validateOptions
- Implement
areAllSwitchesSame
- Implement
assertSwitchesValidity
- add
areSwitchesValid
andareAllSwitchesSame
tovalidateOptions
- add
validateOptions
inextractOptions
- remove
getFiles
- Add extraction of option in
headMain
- show appropriate errors through head.js
- validate line count
- show usage if no arguments are provided.
- fix error format for read file errors
- pull readFile try catch out of main.
- Implement
extractValidOption
- fix error message for illegalOption.
- Implement
parseArgs
.- should give default options if no cl options are passed.
- should work with
-n count
- should work with
-c count
- should work with
-ncount
- should work with
-ccount
- Assert files existence.
- Remove
assertArgumentValidity
- Add more validation for line count.
- make a
parseOption
function. - Add
parseOption
inparseArgs
- implement
printContent
- implement
headSingleFile
- change contract of
head
to accept a separator. - change contract of
headMain
- implement
formatOutput
- implement
headMultipleFiles
- Make headMain for multiple files.
- Make
-num
special option work. - Give appropriate error if byte count is invalid.
- update
readme
with tail contract - create a
testTailLib.js
- create a
tailLib.js
. - implement
tail
- Extract
stringUtils
[ ] ExtractfileUtils
- Extract throw objects to functions.
- Change contract of
headMultipleFiles
to accept a formatter. - Extract
testFileUtils
in a separate functions. - get rid of unnecessary code.
- Consider changing contract of parse args to not convert to number.
- change error of illegal option.
- add error for option required.
- Change directory structure to accommodate for
tail
- make
extractData
- Use
stringUtils
in tail.js - implement
tailMain
for single file. - make
testTailMain.js
- make
tail
work for a single file. - make
createIterator
- Implement basic
parseArgs
to work with files. - implement
getLegalOptions
. - implement
parseLineOption
. - implement
parseCountOption
. - Implement
getOptionsAndParsers
. - Implement
getParser
- Change Name of
parseCountOption
toparseCharOption
- Make
parseArgs
for tail. -
parseArgs
should throw and error if given option is illegal. - Add parameter to
parseArgs
to accept allOptions. - Create separate file for
parseTail
. - move
parseArgs
to library. - Add logic for
+|- num
option inparseArgs
- print correct usage for tail.
- Connect
tail
with cl inputs. - implement
getFileContent
- implement
headFile
- Investigate how slice handles negative indices.
- implement
formatContent
- make
tail
work for multiple files. - use print functions in tail.
- change condition in
isOption
TODO
- investigate on tail not giving empty lines
- seperate parseArgs of head and tail
MAYBE
- handle other edge cases
- consider pulling common pattern from extractLines functions of head and tail
DONE
- Keep the test inputs consistent
- Create directory structure
- Verify mocha
- Establish contract for head without options and without files
- Write test for head
- Implement head without options
- Extract splitting of lines into seperate function
- Have a seperate function for returning only specified number of lines
- Change the contract of head to receive options
- Implement countBytes option
- Implement lineCount option (-n)
- Think about both the options and modify head function
- Implement passing line count option to head from upper level function
- Implement passing default(10) line count option to head from upper level function
- Implement passing byte count option to head using upper level function
- Implement a function to parse args
- Refactor head function
- Write main and pass file
- Change the contract of parse args to return object with consistent keys
- Eventually contract of head will also change
- validateArgs should handle errors
- Clean parseOptions
- Consider having the keys of the option object consistent
- Write tests for functions in parseArgs.js
- Move headMain test cases to different test file
- Clean validateArgs function
- validateOption shouldn't return valid options, seperate that concern to another function
- Think of handling multiple files
- Work on multiple files
- customize the error messages
- test printContent
- Parse and validate together
- Change option object and rename lineCount to line and byteCount to byte
- Implement tail function with option object
- Implement lines option for tail
- Implement bytes option for tail ~~- [ ] Move all the test ~~
- Create tailLib and implement happy path for tail
- Created tailMain
- Connect tailMain to main
TODO
- Make tail work for -n option
- Consider content instead files
Maybe
Done
- Make tail work for -c option
- Consider different contract of option for tail
- simplify tail function.
- Extract lastNLines function
- Consider line count argument to tail function
- tail -n 3 file
- Extract split and join functions
- Make tail work for default option
- Write an expectation for tail
- Create tailLib
- Separate tests of headMain and head into other file
- format multiple files output
- print the errors on error stream, output on output stream
- head -1
- Implement validate function for validation of args
- change the approach of illegal option
- Make head work for options and values without spaces
- Throw error for head -n/-c file
- Change the structure of options
- Throw error for illegal option -[X] head -k 1 file
- Make mockReadFile work for multiple files
- Make head work for more than one file
- head file1 file2 ...
- head -n 3 file1 file2 ...
- head -c 5 file1 file2 ...
- Throw error when non-existing file is provided
- Make head available at top level
- parseArgs should parse multiple files
- Remove stringUtils
- Throw error for more than one option
- Test parseArgs function
- head file
- head -n 3 file
- head -c 5 file
- head -n 1 -n 3 file
- Create parseArgs function
- Create headMain function
- Separate split and join functions to another file
- Extract firstNLines and firstNBytes function
- Extract 0 as start into constant
- Create a common slice function
- Make head work on content instead file without any options(default)
- Implement -c option
- Implement firstBytes function
- Implement -n option
- Accept count as an option object for head
- Test head function
- Correct the contract and tests of firstLines
- Consider different contract for head
- Rename head function to firstLines
- Decide contract for firstLines
- Delegate split and join responsibilies to other function
- Capitalize test descriptions.
- Create different functions for split and join
- Extract constants for '\n'
- verify mocha exists
- Make directory structure src and test
- Verify eslint works properly
- Write first expectation
TODO :
- Make tail file work
- Make parse work for head and tail
- Refactor
head
function - Parse arguments to object
MAY BE
- Consider change contract of parseArgs
Done :
- Make tail -n file work
- Make tail -c file work
- Refactor lastLines and lastCharacters function
- Make tail -c work for content
- Make tail -n work for content
- Make tail work for file content
- Make tail work for single line
- Make tentitive plan for tail
- Establish contract for tail
- Make work for multiple file
- Test headMain function
- Test print function
- Test ProcessFile function
- Test read file function
- Move error functions to new file
- Change logic of structureArgs
- Refactored parseArgs
- Check the function is throwing correct error
- edit error for no such file or directory
- Validate Flag value zero
-
Refactor ValidateArgs function - Refactor parseArgs function
- restructure arguments
- Remove regular expression from isFlag
- Move validate flags in parseFlags
- Change contract of headMain
- Throw an error when file is not present
- Validate flags
- Throw an error if both switches present
- Refactor getValue and getFlag
- make work
-n1
-1
- Consider change contract of head
- Refactor parseArgs function
- Make work when same flag is repeated
- Refactor parseArgs function
- Provide default 10 for
-n
option - write tests for
splitLines
andjoinLines
- Make
head n file
work (-n) - Make
head file
work - Change contract of head
- Make
head bytes
work - Change options structure for
head
- Move
splitLines
andjoinLines
into another file. - Write test cases for
linesUptoCount
- Make
head n
work for file content - Change contract of head function
- Extract function slice
- Make
head
work for file content - Implement head for multiple lines
- Refactor head function
- Make separate functions for split and join
- Implement head for more than 10 lines
- Write test case
- Implement head for single line
- Verify
mocha
exists - use
.eslintrc.json
- Create
testHead.js
intest
- Create
headLib
in test - Create directories
src
andtest
TODO
-
HEAD
- Select delimiter from headMain instead of head
- Modify mockDisplay function testing
- Extract fileReader and headMultipleFiles
-
PARSING
- Refactor parseArgs
- Make parseArgs work for multiple numbered options
-
TAIL
- Implement multiple options
- Fix the validation errors
- Fix the exitCode with the numberOf errors insteadOf setting it to one
MAYBE
- Remove testStringUtils.js
DONE
- Seperate formatResult and displayResult
- Modify parseArgs to take validation functions
- Link tailMain to tail.js to make it work from command line
- Implement parseArgs
- Modify setOption function name
- Take the decision about the line count setOption
- Take the decision about the line count from tailMain instead of tail
- Update usage in tail.js
- Update
README.md
with new options provided - Seperate tailMain tests
- Investigate about new options (q,r)
- Options with and without values
- Multiple files
- Multiple options
- Implement tailMain for multipleFiles
- Implement happy path for tail
- Implement -n option for tail
- Fix tail contract to take the content, options and delimiter
- Implement tailMain for one file
- Implement tail to treat numbers with and without sign accordingly
- Investigate breifly about tail
- How it works
- Options and with their values
- Using multiple options
- Valid and invalid structure or options
- Write a test for
tail
- Make a
tailLib.js
,testTailLib.js
- Add details about
tail
in README.md - Use the type in result to display data in console or error stream
- Dealing arguments when option and number are combined
- Adding header when we have multiple files
- Handle multiple options at the same time
- Add header as a fileName while heading multiple files
- Modify headMain to make it work for multiple files
- Catch errors while parsing
- Implement default options to head function
- Investigate about how head behaves when it find fileNames starting with hypen
- Seperate delimiter from parsing
- Implement -n option from command line
- Implement -c option from command line
- Dealing
head
with files - Linking parseArgs to head.js
- Rename firstNLines function to sliceUpto
- Refactor parseArgs complex logic
- Add a function to Parse commandLine inputs and return options and files
- Report error when file is not readable
- Add number of bytes option
- Add number of lines option
- Modify contract of head to take options
- Modify contract of joinLines to take delimiter and lines
- Modify contract of extractLines to take delimiter and content
- Seperate headMain tests
- Modify parameters of headMain to take objects
- Add feature to pass a file and get back number of lines we require
- Add headMain function to pass the file
- Fix contract of
head
function to take lines with number of lines and get back lines we want - Seperate extractLines and joinLines to stringUtils.js
- Seperate
split
andjoin
from head - Rename head.js in src to headLib.js
- Modify
firstLine
contract to take count with lines and give back count lines - Modify
firstLine
function tofirstNlines
- Add a function which takes lines and gives back first line
- Make 'head' to display single line
- Write a test
- Make
head.js
andtestHead.js
- Create directory structure ( src, test )
- Add eslint and verify mocha exists
TODO
- Make tail work for multiple files.
MAYBE
- Rename character to bytes in function name.
DONE
- Provide args to tailMain from tail.js.
- Segregate tailMain from tail.
- Change contract of tail, tail take content and options as parameters.
- Parameterize tailMain with read file, logger and args.
- Mock external functions.
- Make use of parseArgs functionality.
- Make tail work for multiple lines.
- Add last n lines and last n characters.
- Add happy path tests for tail.
- Create test file for tail.
- Edit README.md, add tail contract.
TODO
- Refactor headMain, separate each file processing and log the report.
MAYBE
- Consider different data structure for head.
DONE
- Consider Change structure of a general function of splitFromStart.
- Split into separate functions for line and bytes.
- Change contract for string utils.
- Added test for split options.
- Validate options, throw error from parser.
- For option value is zero.
- For invalid option.
- Throw from parser, catch in head.js
- Add exit code to headMain.
- Pass console to headMain as a parameter.
- Make head work for multiple files.
- Change head contract
- Extract default form head.js.
- Parse the option in headMain
- Consider to set default count of line numbers as 10.
- Fix test cases.
- Implement parseArgs
- Takes arguments and return obj { files: [...], option: {option:'n', value:2}}.
- Implement try catch block for main in head.js.
- Implement main in head.js.
- Use single file from command line
head file
.
- Use single file from command line
- Implement headMain taking readFile and options.
- Starts headMain with readFile, filename and options.
- Arguments to headMain is readFile and options.
- Test with mocking readFileSync function.
- Implement count option to head (-n).
- Implement bytes option to head (-c).
- Consider changing names of headOfLines ~~~and head~~~.
- Implement options as a parameter to head.
- Use objects for sending options.
- Change the contract of head function.
- Move the split, join and constant to separate file
- Implement test for headOfLines.
- Consider smaller value for default count.
- Use hardcode content, no external input.
- Separate '\n' as a constant
- Extract split and join into functions.
- Make a headOfLine, returns the lines of given count.
- Split the content to multiple lines in head.
- Make test case for Multiple lines.
- Investigate
head
utility. - Make mocha watch.
- Write a test case (happy path).
- Make headLib.js in src.
- Make testHeadLib.js in test.
- Create src and test directory structure.
TODO:
- Move the formatting function to file.
- Move the compiler function to separate file.
- Test rest of the function of validator.
- Change structure of parser.
- Parameterized the validator function created above.
- Create contract for tail.
-
Change the order error thrown
MAYBE:
-
Consider other name for head.
DONE:
- Implement the validator function to validate option at once
- Implement formatArgument to separate combined argument (-n9).
- Implement formatOption to map option to argument.
- Change
iterator
tocreateIterator
- Throw error when no file is passed.
- Introduce new error when no value is passed to option.
- Fix error code when readFileError is thrown.
- Implement the option where hyphen and number is given ( e.g. -9 ).
- Check error handling code inside of getFileContent.
- Implement function to print error and output separate
printHeadOutput
. - Change condition to add header in addHeader.
- Change contract of
getFileContent
. - Change contract of
headMain
. - Redirect error to error stream.
- Exit with exit code.
- Show file name in read file error.
- Create file called error from where all the errors objects are exported.
- Move iterator to its own file.
- Move validator to its own file.
- Consider iterator approach for parseArgs.
- Create parseOption
- Handle fileNames
- Test functions other than parseArgs in
parseArgs.js
. - Catch error in main.
- Extract mapper inside of map in headMain.
- Add headers when there are multiple files.
- Change contract of parseArgs to return fileNames in array.
- For multiple file iterate over file.
- Change head to sliceContent
- Change contract of head to receive flag.
- Change name of parameter from
numOfElements
tolimit
. - Change name of parameter from
delimiter
tooption
. - Make
headMain
to accept all the arguments. - Use parseArgs inside head.
- Create main function to call
headMain
function inhead.js
. - Make it work for single files.
- Create
parseArgs
to parse arguments for head- Create function to check if both option are present are not.
- Create function to get arguments value for args.
- Map options to arguments for head.
- Create defaults.
- Catch error for missing file.
- Catch error for wrong options.
- Catch error for wrong options values.
- Change contract of head to receive readFile function and fileName.
- Change contract of head to receive object;
- Change sliceContent to head
- Create
headMain
to call head. - Refactor head.
- Combine tests of
sliceLines
andsliceBytes
to testsliceContent
- Change contract of head to accept the delimeter.
- Remove
sliceLines
andsliceBytes
- Consider making generic sliceContent function which will work for both bytes and number of characters.
- Remove
sliceLines
- Change
carveLines
tosliceLines
- Change
carveBytes
tosliceBytes
- Remove
splitLines
andjoinLines
- Change tests of
carveLines
andcarveBytes
- Create constant for
\n
. - Implement -c option.
- Create carveByte function.
- Create
carveLines
split content and join lines. - Change contract of
sliceLines
to accept array of lines. - Consider creating
joinLines
function to join lines. - Make head work for given number of lines.
- Create
splitLines
function. - Change
head
tosliceLines
. - Create
head
and callsliceLines
fromhead
. - Move head to
headLib.js
- Create
headLib.js
file. - Make head return given number of lines.
- Make head work for 2 lines.
- Consider returning array of lines from head.
- Make
head
work for one line. - Make
src
andtest
directories. - Create sample file for experiment.
TODO:
head:
- Handle error for invalid options
- Test the parseArgs branch from the headMain
- Refactor headMain funtion
tail:
- Investigate how tail command works
- Make tail work on file content instead of file
MAYBE:
head:
- Rethink name of headFile
- Consider throwing error when option is coming after the file names
DONE:
tail:
- Implement the -n option on file content
- Implement the -c option on file content
- Write expectations for tail
- Make testTailLib.js and tailLib.js
- Establish contract for tail
- Change directory structure test/head test/tail src/head src/tail
head:
- Restructure args data in parsArgs
- Seperate the errorMessages from the functions
- Remove regular expressions
- Consider giving exitcodes from the headMain
- Modify the contract of the formatOutput function instead of multiple fileNames will accept single file
- Handle read file error in the head main
- Mock the console.log and console.error
- Seperate testHeadMain in seperate lib
[x] Extract slice function- Make head work for multiple files
- Rethink on option object
- Make head work with options from command line
- Extract getOption and getValue functions from parseArgs
- Make parser for fileName and options
- Connect head.js to command line
- Extract isOptionfunction for parseArgs
- Implement head for a single file
- Make main function for head
- Seperate string functions in seperate lib
- Implement byte option(-c) for a single file
- Change contract of headLine, accepts content
- Use object as for options
- Envestigate how head works for line count is zero
- Envestigate how head works for empty file
- Add test case empty file content
- Implement count option (-n) for a single file content
- Change the contract of headLine function
- Make head work for file content instead of file
- Test headLine function
- Seperate join and split functions
- Make '\n' as constant
- Seperate 'headLine' to get first 10 lines
- Make head function work for 2 line
- Head function should give first 10 lines if content exceeding more than 10 lines
- Make head function work for 10 line
- Make headlib.js
- Verify 'mocha' exists
- Make head function work for a line
- Write test for head
- Make testHeadLib.js
- Make src and test directories
TODO
- Make tail work for -n and -c as different arguments
- Think of tailParser
MAYBE
DONE
- Extract processFile function from tailMain
- Connect tailMain to tail.js
- Custom error for file not found
- Implement
tail file
- Extract the conditions inside tail if to a new function
- Change parseArgs.js to headParser.js
- Change the directory structure of src and test
- Make tail function work for line and byte count
- Call respective functions in tail according to the object
- Change the contract of tail
- Make a function that works for byte count
- Set default object in the outer function
- Use object for passing the count of lines
- Give limit to lastNLines and tail
- Move common functions to lib directory
- Test tail function
- Create a function that will give array to lastNLines
- Change contract of lastNLines, should take and return array
- Tail should have a limit of ten lines max
- Make tail work for multiline content
- Create testTailLIb.js
- Write a happy path for tail
- Separate head and tail dir in src and test
- Update README.md for tail
TODO
- Think another method instead of using regular expression
- Should print content of files present and error for non present files
MAYBE
DONE
- Split the testParseArgs.js file
- Test isOnlyNumber and addOption
- Should return usage if file is not given
- Test addDefaultsIfEmpty,generateObject and isCombinedOption
- Reduce regular expressions
- Refactor headMain
- Should give illegal count if character is given instead of number
- Should prioritize illegal option over combine option error
- Refactored parseArgs.js
- Used new approach for parseArgs.js
- Should give the same error as head
- Separate error stream and output stream
- Separate validations from parseArgs.js
- Extract functions in parseArgs.js
- Refactor addValidArgs
- Change format of multiple file output
- Refactor parseArgs
- Make head work for no space between option and value
- Reduce parseArgs function statements
- If only -number is given then it should work on -n option
- Work for multiple files
- Should give usage for invalid option
- Should give usage if no argument is given
- Give error when 0 is given with the switches
- Should give help if --help option is given
- Give usage if both options are given by user
- Surround main with a try catch block
- Use while for parseObj instead of for
- Change head function's contract
- Change the object structure
- Make head work for multiple files as input
- Don't set characterCount unless given
- Test addDefaultValue and addOption functions
- Refactor parseArgs function
- Set default lineCount to 10 if no options are given
- Make head work for single file with options
- Move parseArgs to a new file
- Parse options to object
- Use parseArgs in headMain
- Create a parse object function
- Have a try catch for hadMain
- Rename main in headLib.js
- Create a main in head.js
- Create main
- Test main
- Test head function
- Send options as object to head
- Call from head according to the object key
- Split test file into testCharacterCount.js, testLineCount.js and testHead.js
- No default value for characterCount
- Implement characterCount(-c) option
- Rename main to head
- Consider renaming head function
- Hardcode value of lineCount(-n) in main
- Implement lineCount(-n) option
- Consider moving splitLines, joinLines and NEWLINE functions to new file
- Consider making
\n
as a constant - Create a main function
- Create separate functions for split and join
- Test
head
function -
sliceLines
should return only ten lines if more than ten lines are given - Create a function that converts string to array and passes to
sliceLines
- Consider changing the name of
head
function - Use array for
head
function instead of string - Consider a richer contract for
head
- Make
head
work for multiple lines - Change the contract for
head [...file]
- Take argument for the
head
function - Create
src
andtest
directories - Create
testHeadLib.js
- Write a happy path test case
- Start with hard coded content
TAIL TODO
- Make generic parse args
- Make tail work from command line with valid options.
- Make tail work for '-n'
- Made printer for tail
DONE
- Make parse work with -n and -c
- Make tail work for single file without any option.
- Made tail work only for one file content.
- Made tail work for multiple file content;
HEAD TODO:
- validate args returned from structureArgs
MAYBE:
- Consider separating test from
testHeadLib
- Consider better name for
headMultipleFile
.
DONE:
- refactor head and printer
- Changed names of object keys and variables.
- Create separate directory structure for head and tail in src and test
- Document tail contract.
- Refactor printHead function
- separate validate function
- extract error throw in separate function;
- Change approach for parseArgs
- Validate
parseArgs
- add structureArgs
- Test getOption
- Refactor headMultipleFiles
- Make parse work for
-number
- Test CreateIterator
- work on parse error.
- Refactor
parseArgs
- Create separate file for iterator.
- Show error message on std error.
- Validate headMain for wrong fileName.
- Check if head.js working with options for multiple files.
- Make head work on multiple files without any option.
- Make head work with content of multiple files.
- Add mockReadFile that will take multiple file in object.
- Extract formatting work from headMultipleFile
- Update parseArgs, it should return error for wrong args
- Make parse returns multiple files name
- change names of stringUtils functions.
- Change functions and variable names.
- Consider better contract for head.
- Implement
-n
option for one file. - pass
-n
and-c
option to headMain. - Use parseArgs in headMain.
- Implemented parsedArgs.
- Implement head for character [-c].
- Consider changing the name of headLines function.
- Add lineCount argument for head.
- Consider renaming src/head.js.
- Make
head file
working for single file. - Split tests of headMain into separate file.
- Change name of line.js.
- Create headMain
- Consider moving splitLines and joinLines in different file.
- Extract split and join lines in different function.
- Implement head that will work for file content.
- Implement default head for separate lines.
-
headlines
should work for more than 10 lines. - Make corrections in contract
- Move headLines from testHead.js to head.js.
- Create testHead.js
- Verify Mocha
- Create directory structure, separate src and test directory
- Document contract
TODO:
- Modify slice function for tail.
- Refactor parseArgs.
- Parse and validate args for tail.
- Add validations for tail.
- Add -q option in tail.
- Add -r option in tail.
Consider:
-
0
is valid option argument in tail. -
+num
is also a valid option argument in tail. -
-n +num
is also a valid option argument in tail.
DONE:
- Make formatArgs for tail.
- Fix tail main.
- Add test for intermediate functions.
- Make arrow functions.
- Take file from command line for tail.
- Implement tail.js.
- Parameterized the throw message in parse.
- Implement
tail
for data. - Implement tailMain.
- Add expectation/testCase for tail.
- Make
tailLib.js
. - Make
testTailLib.js
. - Read how tail works.
- Set contract for
tail
. - Make mock for console of log and error.
- Should give console error of file is invalid.
- Modified and throwing error messages.
- Correct
illegal count
error. - Change name
count
toline
. - For both valid and invalid files, should give head of valid one and error for invalid file.
- Added validation of arguments in headMain.
- Giving array of objects for filename and content in mock function.
- Move validations in separate file.
- Test formatArgs.
- Removed regular expressions from conditions.
- Should throw error if count is 0
- Throw objects.
- Test intermediate parse functions.
- Test validate options.
- Should give error if both options are given together.
- Should also accept -num as -n num.
- Should work without space between n and num.
- Should give error if any other option than -n and -c is given.
- Should give error if there is options but no file.
- Format output with spaces ,symbol and fileName.
- Should override the option if same option is given again.
- Parser should give more information about the options.
- Modify contract of parseArgs.
- Give usage if no parameters are given.
- Case of -c with 0.
- [x] Using delimiters in options. - Testing of main with multiple files.
- Add spaces while showing output of multiple files.
- Separated parse function with option and default.
- Give head of more than one file.
- Accept and parse more than one file.
- Changing function name
firstLines
. - Combine getLines and getBytes function.
- Extract tests in another file.
- Extract functions in another file.
- Give error if unable to read file.
- Add try catch block while reading file.
- Provide default of 10 for count option.
- Accept options from user.
- Add a function to parse command line arguments.
- Add a sample file for using head.
- Take readFileSyc as parameter.
- Test headMain.
- Make headMain.
- Accept file from user.
- Make head work for data only.
- Make
'\n'
a constant. - Make
0
a constant. - Test giveBytes and giveLines.
- Extract function to count and give lines.
- Extract function to count the bytes.
- Does -c counts the newline character also? (yes)
- Add
bytes
(-c) option. - Object for options of
-c
and-n
. - Pass count in object.
- Change the name of
src/head.js
. - Add option for
count
of lines. - Add parameter to specify count of lines in head.
- Tests for firstLines.
- Parameterize the number of lines in firstLines.
- Extract splitting and joining of content.
- Extract the logic of giving starting lines.
- Should only give upto 10 lines.
- Should split content in array to count.
- Make head work for more than one line.
- Make
head.js
. - Set an expectation/testCase for head.
- Make
testHead.js
file. - Make
src
andtest
directories. - Establish contract for head.
- Make
README.md
.
- TAIL
TODO
- Implement multiple fileContents
- Work on fileContents instead of files
- Implement -r option
- Implement -q option
- Implement default option -n with 10
- Investigate tail
MAYBE
- Consider renaming from variable
- Consider keeping head & tail files together
DONE
- Extract decideIndex
- Extract decideStrategy
- Extract formatNumber
- Decide job based on value
- Implement
bytes
option - Implement
lines
option - Extract tailMain
- Require split & join from head
- Implement tail for multiple lines
- Implement tail for 1 line
- Make a test case pass
- Write a test case/expectation
- Create tailLib.js in src/tail
- Create testTailLib.js in test/tail
- Create directory structure
- HEAD
TODO
- Show show contents & error(if found)
MAYBE
DONE
- Investigate head
- Should work for -optionValue & -option Value
- Consider moving helper functions into helpers.js
- Report error if unable to read file
- Report error if maxLine and maxBytes both are given
- Report error if get 0 as value
- Consider richer structure for headMain
- Display file name if more than one files are given
- Implement multiple files
- Test readFileSync
- Call head function of headLib.js from head.js
- Moved test of headMain function in testHeadMain.js
- Accept file
- Implement multiple fileContents
- Consider tests for head function in a seperate file
- Consider change of internal contracts for parseArgs, head & firstNElements
- Make head work for only contents not file
- Refactor parseArgs
- Consider parseArgs function in a seperate file
- Consider testParseArgs function in a seperate file
- Second option will override first option
- Implement
validateOptionsetDefault function - Make default lines as 10
- Consider rernaming maxLines & maxBytes to lines & bytes
- extract areBothValueSet
- Refactor firstNelements, head
- Consider renaming head & headMain
- Write parseArgs function
- Write headMain function
- Write test for parseArgs
- Write test for headMain
- Write test for contentsUpto
- Write test for getDelimiter
- Extract common function
- BytesUpto & linesUpto are almost same
- SplitCharacters & splitLines are almost same
- JoinCharacters & joinLines are almost same
- Extract bytesUpto function
-
Write test for BytesUpto function - Implement head for 1 byte
- Implement head for multiple bytes
-
Write test for linesUpto function - Extract linesUpto function
- Consider data structure for options
-
Extract splitLines & joinLines function - Implement maxLines option in head function
- Implement head for multiple lines
- Implement head for 1 line
- Implement head for multiple lines
- Rename testHead.js to testHeadLib.js
- Create headLib.js in src/
- Move head.js back to root
-
Move head.js into src/ - Make first test case pass
- Write a test case/expectation
- Create testHead.js
- Verify mocha exists
- Create directory structure