Skip to content
This repository has been archived by the owner on Nov 22, 2022. It is now read-only.

feat(snippet): Add command for creating snippets #952

Merged
merged 1 commit into from
Mar 16, 2022

Conversation

zemzale
Copy link
Collaborator

@zemzale zemzale commented Feb 10, 2022

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 xanzy/go-gitlab#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)

@codecov
Copy link

codecov bot commented Feb 10, 2022

Codecov Report

Merging #952 (a98ce43) into trunk (6e92e27) will increase coverage by 0.02%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            trunk     #952      +/-   ##
==========================================
+ Coverage   59.58%   59.61%   +0.02%     
==========================================
  Files          97       98       +1     
  Lines        7654     7705      +51     
==========================================
+ Hits         4561     4593      +32     
- Misses       2687     2702      +15     
- Partials      406      410       +4     
Impacted Files Coverage Δ
commands/root.go 78.31% <100.00%> (+0.26%) ⬆️
commands/snippet/snippet.go 100.00% <100.00%> (ø)
internal/glrepo/resolver.go 98.61% <0.00%> (-1.39%) ⬇️
commands/issue/create/issue_create.go 30.92% <0.00%> (-1.10%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e92e27...a98ce43. Read the comment docs.

Copy link
Owner

@profclems profclems left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great @zemzale! I'm so excited about this. Just a few nit comments to get this merged

commands/snippet/create/create.go Outdated Show resolved Hide resolved
commands/snippet/create/create.go Outdated Show resolved Hide resolved
commands/snippet/create/create.go Outdated Show resolved Hide resolved
@zemzale zemzale force-pushed the feat-snippet-cmd branch from 73e5888 to a98ce43 Compare March 8, 2022 16:16
@zemzale zemzale requested a review from profclems March 14, 2022 11:16
commands/snippet/snippet_test.go Outdated Show resolved Hide resolved
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 xanzy/go-gitlab#1372

Issue profclems#872
@zemzale zemzale merged commit 7481d31 into profclems:trunk Mar 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants