# The &konsolekalendar; Handbook

## Introduction

&konsolekalendar; is a command line interface to calendars. It lets you view, insert, remove, or modify calendar events by way of the command line or from a scripting language. Additionally, &konsolekalendar; can create a new calendar, export a calendar to a variety of other formats, and import another calendar.

In its basic mode, &konsolekalendar; displays the list of events in your default calendar for the current day (from 7:00 to 17:00).

Main features of &konsolekalendar;:

- View calendar entries from a start date/time to end date/time

- Insert (add) calendar entries

- Remove (delete) calendar entries

- Modify (change) calendar entries

- Create a new calendar

- Export calendar entries to other file formats

- Import an existing calendar

&konsolekalendar; is not another graphical user interface to a &kde; calendar (i.e. &korganizer;). &konsolekalendar; is intended solely for uses where a graphical user interface is not practical or possible.

&konsolekalendar; does not provide a full-featured language for making queries of the user's calendar: nor is it the intention of the authors to ever write such a capability. Primitive command line options are provided for accessing calendar events within a consecutive range of dates/time stamps.

## Features

In this chapter you'll learn about the main features of &konsolekalendar; and how to control them using the command line parameters (remember that &konsolekalendar; is not a graphical user interface; it is a command line program only).

You'll learn about inserting, deleting, and changing calendar events, and how to export events to other file formats. The creation and importation of calendars will also be covered in this chapter.

### Viewing Events

In its default mode, or by using the `--view` option, &konsolekalendar; will list all events within the range of a specified date/time.

To view all of today's events (from 7:00 to 17:00), simply run:

    % konsolekalendar

In this next example, we view all events for the week of August 18-22:

    % konsolekalendar --view --date 2016-08-18  --end-date 2016-08-22

Show the next event(s) on the calendar from the current time forward:

    % konsolekalendar --next

To view all events for the next 5 days run:

    % konsolekalendar --show-next 5

### Inserting Events

&konsolekalendar; can insert events into a calendar or calendar resource using the `--add` command line argument. Events successfully inserted will be immediately shown by &kde; calendar applications (like &korganizer;).

You get a list of all calendars and their id's using:

    % konsolekalendar --list-calendars

In the following example, an event starting on 2016-12-01 (December 1, 2016) at 10:00 and ending at 12:00 with summary "Doctor Visit" will be inserted into the user's calendar resource with the id 8:

    % konsolekalendar --add --calendar 8 --date 2016-12-03 --time 10:00 \
    --end-time 12:00 --summary "Doctor Visit"

In this example, a birthday event is added into the user's calendar resource with the id 8:

    % konsolekalendar --add --calendar 8 --date 2016-12-06 --summary "My Birthday" \
    --description "Party Time"

Here a one week vacation is inserted into a calendar with the id 8:

    % konsolekalendar --add --calendar 12 --date 2017-08-01 \
    --end-date 2017-08-07 --summary "Vacation" --description "Nobody will ever find me!"

### Removing Entries

&konsolekalendar; supports the removal of entries in a calendar file or resource using the `--delete` command line argument. Calendar entries to be removed are specified exactly by their Unique-string identifier (UID) using the `--uid` option. UIDs are found by first viewing the event, using the `--view`, `--next` or `--show-next` options.

Events successfully deleted will be immediately removed from within &kde; calendar applications (&korganizer; for example).

When you delete something from the calendar you cannot undo it! In other words, when you delete an entry you cannot reverse the deletion. It's gone for good.

Here we delete a calendar entry with UID `&konsolekalendar;-1887551750.196`:

    % konsolekalendar --delete --uid &konsolekalendar;-1887551750.196

### Modifying Entries

&konsolekalendar; supports the modification of existing entries in a calendar file or resource using the `--change` command line argument. Calendar entries to be modified are specified exactly by their Unique-string identifier (UID) using the `--uid` option. UIDs are found by first viewing the event, using the `--view`, `--next` or `--show-next` options.

Changing behaves in the same way as inserting: you can change an event's start date and time, end date and time, summary, location, and description. Events successfully changed will be immediately shown modified within &kde; calendar applications (&korganizer;).

Example: Here we change the summary and description of a calendar entry with UID `&konsolekalendar;-1887551750.196`:

`%```konsolekalendar` `--change` `--uid `&konsolekalendar;-1887551750.196`` `--summary `"Get my head examined"`` `--description `"don't go to that doctor anymore!"```

### Creating a New Calendar File

&konsolekalendar; can be used to create new calendars from existing files. You can create the calendar using the option `--create` with the filename as argument. The file must be a valid iCal or vCal file.

Note: You can not use the option `--dry-run` to test if the resource can be created.

Note: &konsolekalendar; needs the file to work, so never delete the file by hand.

Technical sidenote: &konsolekalendar; creates with this command a new Akonadi resource pointing to this file. It does not prevent you to create multiple resources pointing to the same file.

Create a new calendar from an existing file named ``vacation.ics``:

    % konsolekalendar --create vacation.ics

The resource will be named vacation using `--list-calendars`

It is not possible to delete an Akonadi resource with &konsolekalendar;, you have to use &korganizer; or akonadiconsole.

### Exporting to Other Formats

&konsolekalendar; can export a calendar to other well known formats. Exporting is a special form of viewing. By default, events are viewed in &konsolekalendar; text format. To change the viewing format use the `--export-type` command line argument.

To see a list of all supported export formats, use the `--export-list` option, as in:

    % konsolekalendar --export-list

### Export Formats

Some, but not necessarily all, of the supported formats are described in the this section.

#### &konsolekalendar; Text Format

&konsolekalendar; Text Format is &konsolekalendar;'s native format and is designed to be comfortable to read and to be parsed by follow-on scripts.

The &konsolekalendar; Text Format is:

    Date:\t<Incidence Date>(dddd yyyy-MM-dd)
    [\t<Incidence Start Time>(hh:mm) - <Incidence End Time>(hh:mm)]
    Summary:
    \t<Incidence Summary | "(no summary available)">
    Location:
    \t<Incidence Location | "(no location available)">
    Description:
    \t<Incidence Description | "(no description available)">
    UID:
    \t<Incidence UID>
    --------------------------------------------------

Output of ``konsolekalendar` `--next` `--export-type` `Text``:

    Date:   Tuesday 2016-11-29
            08:00 - 09:00
    Summary:
            Staff Meeting
    Location:
            Conference Room
    Description:
            Meet with the entire staff to discuss the project.
    UID:
            &konsolekalendar;-1924621834.134
    --------------------------------------------------

#### &konsolekalendar; Short Text Format

Short Text Format provides a more compact, less verbose version of &konsolekalendar;'s native format.

The &konsolekalendar; Short Text Format is:

    [--------------------------------------------------]
    {<Incidence Date>(dddd yyyy-MM-dd)]
    [<Incidence Start Time>(hh:mm) - <Incidence End Time>(hh:mm) | "\t"]
    \t<Incidence Summary | \t>[, <Incidence Location>]
    \t\t<Incidence Description | "\t">

Output of ``konsolekalendar` `--next` `--export-type` `Short``:

    --------------------------------------------------
    Tuesday 2016-11-29
    08:00 - 09:00   Staff Meeting, Conference Room
                    Meet with the entire staff to discuss the project.

#### Comma-Separated Values (CSV) Format

Comma-Separated Value Format displays the event values in the same order as &konsolekalendar; Text format. The only difference is that all the information is on the same row with each field separated by a comma. The resulting exported files can be imported directly into spreadsheet programs like &calligrasheets;, OpenOffice.org Calc, and &Microsoft; Excel. Also, CSV format is easy to parse with follow-on scripts.

The Comma-Separated Value (CSV) format is:

    "Weekday, Month Day, Year","HH:MM","Weekday, Month Day, Year","HH:MM","Summary","Location","Description","UID"

Output of ``konsolekalendar` `--next` `--export-type` `CSV``:

    "Tuesday, November 29, 2016","08:00","Tuesday, November 29, 2016","09:00","Staff Meeting","Conference Room","Meet in the big conference \
    room with the entire staff.","&konsolekalendar;-1924621834.134"

### Importing Calendars

&konsolekalendar; can import an iCal or vCal calendar file into calendar. All events from the calendar being imported from will be inserted, skipping identical events, that are already part of the calendar.

To import calendar file `vacation.ics` into calendar with the id `8` run:

    % konsolekalendar --import vacation.ics --calendar 8

## Command Line Arguments

&konsolekalendar; supports the following options:

Option | Description
Generic options:
`--help, --help-all` | Shows help about the program options.
`--author` | Shows the program author information.
`-v, --version` | Shows the program version information.
`--license` | Shows the program license information.
Options:
`--verbose` | Print helpful runtime messages.
`--dry-run` | Print what would have been done, but do not execute. Do not change any files; do not insert, remove, modify any existing files, nor create any new files.
`--allow-gui` | Permit resources which might need an interactive user interface. In normal operation, only resources which never will require a user interface are used (like file-based calendars).
Incidence types (these options can be combined):
`--event` | Operate for Events only (Default).
`--todo` | Operate for Todos only. (Not implemented)
`--journal` | Operate for Journals only. (Not implemented)
Major Operation Modes:
`--view` | Print calendar events in specified export format.
`--add` | Insert an event into the calendar.
`--change` | Modify an existing calendar event.
`--delete` | Remove an existing calendar event.
`--create` `filename` | Create a new calendar from existing file.
`--import` `import-file` | Import this calendar to the main calendar.
`--list-calendars` | List available calendars.
Operation modifiers:
`--all` | View all calendar entries.
`--next` | View next activity in calendar.
`--show-next` `days` | Starting at specified date show next # days' activities.
`--uid` `UID` | View, delete, or change the event with this Unique-string IDentifier.
`--date` `date` | Start at this day [YYYY-MM-DD]. Default date is Today
`--time` `time` | Start at this time [HH:MM]. Default time for viewing is 07:00. To add or change a floating event, use the `--time float` or the `--end-time float` options.
`--end-date` `end-date` | End at this day [YYYY-MM-DD]. Default is set by `--date`.
`--end-time` `end-time` | End at this time [HH:MM]. Default end-time for viewing is 17:00. To add or change a floating event, use the `--time float` or the `--end-time float` options.
`--epoch-start` `epoch-time` | Start at this time [seconds since epoch].
`--epoch-end` `epoch-time` | End at this time [seconds since epoch].
`--summary` `summary` | Add summary to event (works with add and change).
`--description` `description` | Add description to event (works with add and change).
`--location` `location` | Add location to event (works with add and change).
`--calendar` `id` | Specify a calendar to use. If not specified then your default &korganizer; resource is used.
Export options:
`--export-type` `export-type` | Export file type. Default export file type is Text
`--export-file` `export-file` | Export to file. By default, output is written to standard output.
`--export-list` | Print list of export types supported and exit.

## Questions and Answers

What configuration files does &konsolekalendar; use?

None.

What are the application names of &konsolekalendar;?

&konsolekalendar;'s application name is konsolekalendar.

What is the date specification format?

&konsolekalendar; will reject dates specified on the command line unless they are specified according to ISO 8601 standards, namely: YYYY-MM-DD. Where YYYY represents a four-digit year (like 2003), MM represents a two-digit month (01,02,..,12), and DD represents a two-digit day (01,02,...,31).

&konsolekalendar; always exports dates according to the ISO 8601 format.

What is the time specification format?

&konsolekalendar; will reject times specified on the command line unless they are specified according to ISO 8601 standards, namely: HH:MM:SS. Where HH represents a two-digit hour (01,02,...,24), MM represents a two-digit minute (01,02,..,60), and SS represents a two-digit second (01,02,...,60).

&konsolekalendar; always exports times according to the ISO 8601 format.

Will &konsolekalendar; insert a new event that is identical to one that already exists in the calendar?

No. See next question.

How does &konsolekalendar; determine if an event is identical to one that already exists in the calendar?

&konsolekalendar; checks the specified start date and time, end date and time, and summary against all events in the calendar. An event match is determined if all three values match to an existing event.

Can a non-floating event be changed to a floating event?

Yes. Use the `--time float` option with `--change`.

Why are event UIDs printed in most export formats?

Because you need to specify UIDs to delete or change events. If you do not want to see event UIDs then use the short export type (`--export-type short`).

How do I have my question added to this FAQ?

Send your questions to winter@kde.org.

## Credits and License

&konsolekalendar; Program copyright 2002-2007:

- Tuukka Pasanen illuusio@mailcity.com

- Allen Winter winter@kde.org

Documentation copyright 2003:

- Allen Winter winter@kde.org

- Tuukka Pasanen illuusio@mailcity.com

&underFDL; &underGPL;
&documentation.index;