Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
T
time-slime
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Michael Rouse
time-slime
Commits
39241a79
Commit
39241a79
authored
Aug 14, 2018
by
Michael Rouse
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on the help screen
parent
70b052ab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
7 deletions
+81
-7
src/args/args.c
src/args/args.c
+2
-2
src/args/args.h
src/args/args.h
+1
-3
src/string_literals.h
src/string_literals.h
+38
-0
src/timeslime.c
src/timeslime.c
+36
-1
src/timeslime.h
src/timeslime.h
+4
-1
No files found.
src/args/args.c
View file @
39241a79
...
...
@@ -24,7 +24,7 @@ timeslime_args parse_args(int argc, char **argv)
if
(
num_args
>
0
)
{
result
.
action
=
args
[
0
];
if
(
strcmp
(
HELP_A
RG
,
args
[
0
])
==
0
)
if
(
strcmp
(
HELP_A
CTION
,
args
[
0
])
==
0
)
{
result
.
help
=
True
;
return
result
;
// Nothing else matters
...
...
@@ -66,7 +66,7 @@ timeslime_date parse_date(char *dateStr)
for
(
i
=
0
;
i
<=
strlen
(
dateStr
);
i
++
)
{
// - and / are valid separators
if
(
dateStr
[
i
]
==
'/'
||
dateStr
[
i
]
==
'\0'
)
if
(
dateStr
[
i
]
==
'/'
||
dateStr
[
i
]
==
'
-'
||
dateStr
[
i
]
==
'
\0'
)
{
log_debug
(
"Found Date Separator: %c, read: %s"
,
dateStr
[
i
],
running
);
tmp
=
atoi
(
running
);
...
...
src/args/args.h
View file @
39241a79
...
...
@@ -5,9 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include "../logger.h"
/* Constants */
#define HELP_ARG "help"
#include "../string_literals.h"
#define False 0
...
...
src/
command
s.h
→
src/
string_literal
s.h
View file @
39241a79
...
...
@@ -7,8 +7,17 @@
/* ACTIONS */
#define ADD_ACTION "add"
#define ADD_ACTION_DESCRIPTION "Add hours to your time sheet for a certain day. Defaults to the current date"
#define CLOCK_ACTION "clock"
#define CLOCK_ACTION_DESCRIPTION "Clock in or clock out of your time sheet"
#define REPORT_ACTION "report"
#define REPORT_ACTION_DESCRIPTION "Show all hours worked between two date ranges"
#define HELP_ACTION "help"
#define HELP_ACTION_DESCRIPTION "Receive information on how to use the program or an action"
/* Misc. */
#define TODAY "Today"
...
...
@@ -17,4 +26,13 @@
#define CLOCK_OUT "out"
/* About */
#define PROGRAM_NAME "timeslime"
#define AUTHOR "Michael Rouse"
#define DESCRIPTION "\nTime Slime is a command line utility to keep \ntrack of hours worked remotely. \nA time sheet in your terminal!"
#define PROGRAM_VERSION "2018.08.14"
#endif
\ No newline at end of file
src/timeslime.c
View file @
39241a79
...
...
@@ -18,7 +18,9 @@ int main(int argc, char *argv[])
parsed_args
=
parse_args
(
argc
,
argv
);
if
(
parsed_args
.
help
)
printf
(
"Helping
\n
"
);
{
display_help
();
}
else
{
if
(
strcmp
(
parsed_args
.
action
,
ADD_ACTION
)
==
0
)
...
...
@@ -126,4 +128,37 @@ void perform_report_action(timeslime_args args)
log_info
(
"Running report between %s and %s"
,
startDate
.
str
,
endDate
.
str
);
}
/* Help Screen */
void
display_help
(
void
)
{
printf
(
"Author: %s
\n
"
,
AUTHOR
);
printf
(
"Version: %s
\n
"
,
PROGRAM_VERSION
);
printf
(
"%s
\n\n\n
"
,
DESCRIPTION
);
printf
(
"Usage:
\n
"
);
printf
(
"
\t
%s [action] [arguments...]
\n\n
"
,
PROGRAM_NAME
);
printf
(
"Actions:
\n
"
);
printf
(
"
\t
%s
\t
%s
\n
"
,
ADD_ACTION
,
ADD_ACTION_DESCRIPTION
);
printf
(
"
\t
%s
\t
%s
\n
"
,
CLOCK_ACTION
,
CLOCK_ACTION_DESCRIPTION
);
printf
(
"
\t
%s
\t
%s
\n
"
,
REPORT_ACTION
,
REPORT_ACTION_DESCRIPTION
);
printf
(
"
\n
"
);
printf
(
"
\t
%s
\t
%s
\n\n
"
,
HELP_ACTION
,
HELP_ACTION_DESCRIPTION
);
printf
(
"
\n
%s Action Usage:
\n
"
,
ADD_ACTION
);
printf
(
"
\t
%s add (+|-)[0-9]
\n
"
,
PROGRAM_NAME
);
printf
(
"
\t
%s add (+|-)[0-9] YYYY/MM/DD
\n\n
"
,
PROGRAM_NAME
);
printf
(
"%s Action Usage:
\n
"
,
CLOCK_ACTION
);
printf
(
"
\t
%s clock (in|out)
\n\n
"
,
PROGRAM_NAME
);
printf
(
"%s Action Usage:
\n
"
,
REPORT_ACTION
);
printf
(
"
\t
%s report YYYY/MM/DDD YYYY/MM/DDD
\n
"
,
PROGRAM_NAME
);
printf
(
"
\n
"
);
}
\ No newline at end of file
src/timeslime.h
View file @
39241a79
...
...
@@ -11,7 +11,7 @@
#include "args/args.h"
#include "logger.h"
#include "
command
s.h"
#include "
string_literal
s.h"
/* Add to the time sheet */
...
...
@@ -23,4 +23,7 @@ void perform_clock_action(timeslime_args args);
/* Show time worked for a period of time */
void
perform_report_action
(
timeslime_args
args
);
/* Displays the help screen */
void
display_help
(
void
);
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment