Skip to content

Commit

Permalink
feat(generator): improve quickstart skeleton (#7828)
Browse files Browse the repository at this point in the history
  • Loading branch information
coryan authored Jan 6, 2022
1 parent 7b0ffcb commit 6d7bceb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions generator/internal/scaffold_generator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -868,21 +868,25 @@ void GenerateQuickstartSkeleton(
// limitations under the License.
#include "google/cloud/$library$/ EDIT HERE .h"
#include "google/cloud/project.h"
#include <iostream>
#include <stdexcept>
int main(int argc, char* argv[]) try {
if (argc != 4) {
std::cerr << "Usage: " << argv[0]
<< " project-id \n";
if (argc != 2) {
std::cerr << "Usage: " << argv[0] << " project-id\n";
return 1;
}
namespace $library$ = ::google::cloud::$library$;
auto client = $library$::Client(
$library$::MakeConnection(/* EDIT HERE */));
// EDIT HERE: add some code
auto const project = google::cloud::Project(argv[1]);
for (auto r : client.List/*EDIT HERE*/(project.FullName()) {
if (!r) throw std::runtime_error(r.status().message());
std::cout << r->DebugString() << "\n";
}
return 0;
} catch (std::exception const& ex) {
Expand Down

0 comments on commit 6d7bceb

Please sign in to comment.