You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ft_plot_crosshair.m
    path of file: ./repos/bspm/thirdparty/spm12/external/fieldtrip/plotting
    
    the code of the file until where you have to start completion: function h = ft_plot_crosshair(pos, varargin)

% FT_PLOT_CROSSHAIR plots a crosshair at a specified position in two [x, y] or three
% [x, y, z] dimensions. 
%
% Use as
%   h = ft_plot_crosshair(pos, ...)
% where pos is the desired position of the crosshair. The handles of the lines are
% returned.
%
% Optional input arguments should be specified in key-value pairs and can include
%   'color'    = [r g b] value or string, see PLOT
%   'parent'   = handle of the parent axes
%   'handle'   = handle of the existing line objects to be updated
% 

    
function h = ft_plot_crosshair(pos, varargin)

% FT_PLOT_CROSSHAIR plots a crosshair at a specified position in two [x, y] or three
% [x, y, z] dimensions. 
%
% Use as
%   h = ft_plot_crosshair(pos, ...)
% where pos is the desired position of the crosshair. The handles of the lines are
% returned.
%
% Optional input arguments should be specified in key-value pairs and can include
%   'color'    = [r g b] value or string, see PLOT
%   'parent'   = handle of the parent axes
%   'handle'   = handle of the existing line objects to be updated
% 
% You can specify the handles of existing line objects which will be then updated,
% rather than creating a new set of lines. If both parent and handle ar specified,
% the handle option prevail.
% 
% Example
%   ft_plot_crosshair([0.5 0.5], 'color', 'r')
%
% See also TEXT, LINE

% Copyright (C) 2003-2017, Robert Oostenveld
%
% This file is part of FieldTrip, see http://www.fieldtriptoolbox.org
% for the documentation and details.
%
%    FieldTrip is free software: you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation, either version 3 of the License, or
%    (at your option) any later version.
%
%    FieldTrip is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with FieldTrip. If not, see <http://www.gnu.org/licenses/>.
%
% $Id$

% get the optional input arguments
color  = ft_getopt(varargin, 'color');
parent = ft_getopt(varargin, 'parent');
h      = ft_getopt(varargin, 'handle');

if ~isempty(h)
  % the parent to the first handle is set as the current axes
  set(gcf, 'currentaxes', get(h(1),'parent'));
elseif ~isempty(parent)
  % the parent is set as the current axes
  set(gcf, 'currentaxes', parent);
else
  % the current axes stay as they are
end