Skip to content

feat(snippet): Add command for creating snippets

Kerri Miller requested to merge github/fork/zemzale/feat-snippet-cmd into trunk

Created by: zemzale

Description

This adds a simple snippet creation command. This currently just allows for creating snippets from STDIN like so:

echo "this is a script" | glab snippet create --title "snippet" --filename "example.py"

There are few things that are missing from this, like ability to add more then one file to the snippet, but that is not supported by the "github.com/xanzy/go-gitlab" yet.

Issue is opened for that https://github.com/xanzy/go-gitlab/issues/1372

There are gonna be follow up MRs to add some extra things like:

  • creating personal snippets
  • creating snippets with multiple files
  • adding snippets from files instead of STDIN

Even with those features missing this should be a good start

Related Issue

Issue #872

How Has This Been Tested?

Local tests and some unit tests

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation
  • Chore (Related to CI or Packaging to platforms)

Merge request reports