KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
command_fp_upgrade.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2022 Mark Roszko <mark.roszko@gmail.com>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "command_fp_upgrade.h"
22#include <cli/exit_codes.h>
23#include "jobs/job_fp_upgrade.h"
24#include <kiface_base.h>
25#include <layer_ids.h>
26#include <wx/crt.h>
27#include <wx/dir.h>
28
29#include <macros.h>
30
31#define ARG_FORCE "--force"
32
34 PCB_EXPORT_BASE_COMMAND( "upgrade", true, true )
35{
36 m_argParser.add_description( UTF8STDSTR( _( "Upgrades the footprint library to the current "
37 "kicad version format" ) ) );
38
39 m_argParser.add_argument( ARG_FORCE )
40 .help( UTF8STDSTR(
41 _( "Forces the footprint library to be resaved regardless of versioning" ) ) )
42 .flag();
43}
44
45
47{
48 std::unique_ptr<JOB_FP_UPGRADE> fpJob = std::make_unique<JOB_FP_UPGRADE>();
49
50 fpJob->m_libraryPath = m_argInput;
51 fpJob->m_outputLibraryPath = m_argOutput;
52 fpJob->m_force = m_argParser.get<bool>( ARG_FORCE );
53
54 int exitCode = aKiway.ProcessJob( KIWAY::FACE_PCB, fpJob.get() );
55
56 return exitCode;
57}
argparse::ArgumentParser m_argParser
Definition: command.h:100
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition: kiway.h:285
@ FACE_PCB
pcbnew DSO
Definition: kiway.h:293
int ProcessJob(KIWAY::FACE_T aFace, JOB *aJob, REPORTER *aReporter=nullptr)
Definition: kiway.cpp:711
#define UTF8STDSTR(s)
Definition: command.h:27
#define ARG_FORCE
#define _(s)
This file contains miscellaneous commonly used macros and functions.