Giter Club home page Giter Club logo

itp-cli's Introduction

ITP-Cli

Creating custom command client that parse tsv (Tab Separated Value) file

Problem to solve

Write a console application which reads some input data, transforms the data according to the following instructions and finally outputs the results to console.

The application should support the following command line arguments (only the first one is mandatory):

--file full path to the input file --sortByStartDate sort results by column "Start date" in ascending order --project filter results by column "Project"

The following requirements define the program functionality and refer to the data sample below (between and excluding the lines starting with "***"):

  • Input data is tab-separated UTF-8 text with a header row.

  • It only includes the columns listed below.

  • Dates (Start date) should conform to the format yyyy-mm-dd hh:mm:ss.sss

  • Money (Savings amount) values should conform be numbers with a point as the decimal separator

  • Columns "Savings amount" and "Currency" can have missing values denoted as NULL. Those should be printed as empty strings.

  • Column "Complexity" has a certain set of values (Simple, Moderate, Hazardous). The program should report an error if a source value differs from those three but keep in mind that more options (e.g. "VeryHigh") can be added in the future.

  • The output should also have a header line.

  • Lines that are empty or start with comment mark # are skipped.

  • Order (but not names) of columns might be changed in future.

  • In case of an invalid source value (in a date, money or Complexity column) a descriptive error message should be printed to console and the program terminated.

***********************************************************************************************************************************************
# Input file contents are between the two lines marked with stars
Project	Description	Start date	Category	Responsible	Savings amount	Currency	Complexity
2	Harmonize Lactobacillus acidophilus sourcing	2014-01-01 00:00:00.000	Dairy	Daisy Milks	NULL	NULL	Simple
3	Substitute Crème fraîche with evaporated milk in ice-cream products	2013-01-01 00:00:00.000	Dairy	Daisy Milks	141415.942696	EUR	Moderate
3	Substitute Crème fraîche with evaporated milk in ice-cream products	2013-01-01 00:00:00.000	Dairy	Daisy Milks	141415.942696	EUR	Moderate
4	Decrease production related non-categorized side costs	2013-01-01 00:00:00.000	Dairy	Daisy Milks	11689.322459	EUR	Hazardous
4	Decrease production related non-categorized side costs	2013-01-01 00:00:00.000	Dairy	Daisy Milks	11689.322459	EUR	Hazardous
5	Stop using Kryptonite in production	2013-04-01 00:00:00.000	Dairy	Clark Kent	NULL	NULL	Moderate
6	Black and white logo paper	2012-06-01 00:00:00.000	Office supplies	Clark Kent	4880.199567	EUR	Simple
6	Black and white logo paper	2012-06-01 00:00:00.000	Office supplies	Clark Kent	4880.199567	EUR	Simple
***********************************************************************************************************************************************

How to run

Allocate itp.exe file inside ITP_Cli.ShellCmd and run from there windows command prompt and run this command

$ itp --file "tsv file path" --sortByStartDate --project [any number]

itp-cli's People

Contributors

khaledov avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.