diff --git a/src/commands/CmdSummary.cpp b/src/commands/CmdSummary.cpp index c0c97863..adad94c7 100644 --- a/src/commands/CmdSummary.cpp +++ b/src/commands/CmdSummary.cpp @@ -82,6 +82,7 @@ int CmdSummary ( Color colorID (rules.getBoolean ("color") ? rules.get ("theme.colors.ids") : ""); auto ids = findHint (cli, ":ids"); + auto show_annotation = findHint (cli, ":annotations"); Table table; table.width (1024); @@ -91,10 +92,20 @@ int CmdSummary ( table.add ("Day"); if (ids) + { table.add ("ID"); + } table.add ("Tags"); - table.add ("Annotation"); + + auto offset = 0; + + if (show_annotation) + { + table.add ("Annotation"); + offset = 1; + } + table.add ("Start", false); table.add ("End", false); table.add ("Time", false); @@ -131,32 +142,40 @@ int CmdSummary ( today.end = Datetime (); std::string tags = join(", ", track.tags()); - auto annotation = track.getAnnotation (); - - if (annotation.length () > 15) - annotation = annotation.substr (0, 12) + "..."; if (ids) + { table.set (row, 3, format ("@{1}", track.id), colorID); + } table.set (row, (ids ? 4 : 3), tags); - table.set (row, (ids ? 5 : 4), annotation); - table.set (row, (ids ? 6 : 5), today.start.toString ("h:N:S")); - table.set (row, (ids ? 7 : 6), (track.is_open () ? "-" : today.end.toString ("h:N:S"))); - table.set (row, (ids ? 8 : 7), Duration (today.total ()).formatHours ()); + + if (show_annotation) + { + auto annotation = track.getAnnotation (); + + if (annotation.length () > 15) + annotation = annotation.substr (0, 12) + "..."; + + table.set (row, (ids ? 5 : 4), annotation); + } + + table.set (row, (ids ? 5 : 4) + offset, today.start.toString ("h:N:S")); + table.set (row, (ids ? 6 : 5) + offset, (track.is_open () ? "-" : today.end.toString ("h:N:S"))); + table.set (row, (ids ? 7 : 6) + offset, Duration (today.total ()).formatHours ()); daily_total += today.total (); } if (row != -1) - table.set (row, (ids ? 9 : 8), Duration (daily_total).formatHours ()); + table.set (row, (ids ? 8 : 7) + offset, Duration (daily_total).formatHours ()); grand_total += daily_total; } // Add the total. - table.set (table.addRow (), (ids ? 9 : 8), " ", Color ("underline")); - table.set (table.addRow (), (ids ? 9 : 8), Duration (grand_total).formatHours ()); + table.set (table.addRow (), (ids ? 8 : 7) + offset, " ", Color ("underline")); + table.set (table.addRow (), (ids ? 8 : 7) + offset, Duration (grand_total).formatHours ()); std::cout << '\n' << table.render () diff --git a/src/init.cpp b/src/init.cpp index ad893ab9..fae94fe5 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1,6 +1,6 @@ //////////////////////////////////////////////////////////////////////////////// // -// Copyright 2015 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez. +// Copyright 2016 - 2018, Thomas Lauf, Paul Beckingham, Federico Hernandez. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -93,6 +93,7 @@ void initializeEntities (CLI& cli) cli.entity ("hint", ":debug"); cli.entity ("hint", ":fill"); cli.entity ("hint", ":ids"); + cli.entity ("hint", ":annotations"); cli.entity ("hint", ":lastmonth"); cli.entity ("hint", ":lastquarter"); cli.entity ("hint", ":lastweek");