Added information on actions and flags to use the program when no arguments are supplied
This commit is contained in:
@@ -4,10 +4,11 @@
|
|||||||
#include "Managers/CommitManager.h"
|
#include "Managers/CommitManager.h"
|
||||||
#include "Models/API.h"
|
#include "Models/API.h"
|
||||||
#include "Models/Token.h"
|
#include "Models/Token.h"
|
||||||
|
#include "Syncers/SyncerBase.h"
|
||||||
|
|
||||||
namespace Syncers
|
namespace Syncers
|
||||||
{
|
{
|
||||||
class RetrieveRecords
|
class RetrieveRecords: public SyncerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RetrieveRecords();
|
RetrieveRecords();
|
||||||
|
|||||||
+34
-1
@@ -12,11 +12,44 @@ using std::string;
|
|||||||
using Managers::ActionManager;
|
using Managers::ActionManager;
|
||||||
using Managers::CommitManager;
|
using Managers::CommitManager;
|
||||||
|
|
||||||
|
void printHelp()
|
||||||
|
{
|
||||||
|
cout<<"icd [Action] [flag]\n\n";
|
||||||
|
|
||||||
|
cout<<"Actions\n";
|
||||||
|
cout<<"download\n";
|
||||||
|
cout<<"upload\n";
|
||||||
|
cout<<"retrieve\n";
|
||||||
|
cout<<"delete\n\n";
|
||||||
|
|
||||||
|
cout<<"Flags\n";
|
||||||
|
cout<<"Required for all actions\n";
|
||||||
|
cout<<"-u username\n";
|
||||||
|
cout<<"-p password\n";
|
||||||
|
cout<<"-h host\n\n";
|
||||||
|
|
||||||
|
cout<<"Required for upload\n";
|
||||||
|
cout<<"-s path of song\n";
|
||||||
|
cout<<"-sd directory where to search for songs to upload (Optional)\n";
|
||||||
|
cout<<"-sr directory where to recursively search for songs to upload (Optional)\n\n";
|
||||||
|
|
||||||
|
cout<<"Required for download\n";
|
||||||
|
cout<<"-b song id\n";
|
||||||
|
cout<<"-d path to download song (Optional)\n\n";
|
||||||
|
|
||||||
|
cout<<"Required for retrieving records\n";
|
||||||
|
cout<<"-rt retrieve type (songs is only accepted)\n\n";
|
||||||
|
|
||||||
|
cout<<"Required for deleting a song\n";
|
||||||
|
cout<<"-D song id\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
cout<<"No actions provided"<<endl;
|
printHelp();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,12 @@ namespace Syncers
|
|||||||
cpr::Header{{"authorization", auth},
|
cpr::Header{{"authorization", auth},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (r.status_code != (int)Result::OK) {
|
||||||
|
cout<<"something went wrong\n";
|
||||||
|
cout<<"status code: "<<r.status_code<<endl;
|
||||||
|
cout<<"message: "<<r.text<<endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto songData = nlohmann::json::parse(r.text);
|
auto songData = nlohmann::json::parse(r.text);
|
||||||
|
|
||||||
ofstream writeData{};
|
ofstream writeData{};
|
||||||
|
|||||||
@@ -79,8 +79,6 @@ namespace Syncers
|
|||||||
{
|
{
|
||||||
song = uploadSong(token, song);
|
song = uploadSong(token, song);
|
||||||
}
|
}
|
||||||
printSongDetails(songs);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (exception& e)
|
catch (exception& e)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user