examples/testplugin: Add test plugin example
This commit is contained in:
		
							parent
							
								
									4c3f0056fd
								
							
						
					
					
						commit
						d694a8acf6
					
				
							
								
								
									
										32
									
								
								examples/testplugin/main.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								examples/testplugin/main.go
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import "html/template"
 | 
			
		||||
import "git.tebibyte.media/sashakoshka/step"
 | 
			
		||||
 | 
			
		||||
var _ step.FuncProvider = new(Provider)
 | 
			
		||||
 | 
			
		||||
// Provider provides sample functions.
 | 
			
		||||
type Provider struct {
 | 
			
		||||
	
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NewProvider creates a new provider and returns it.
 | 
			
		||||
func NewProvider () step.Provider {
 | 
			
		||||
	return new(Provider)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Package fulfills the step.Provider interface.
 | 
			
		||||
func (this *Provider) Package () string {
 | 
			
		||||
	return "git.tebibyte.media/sashakoshka/step/examples/testplugin"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// FuncMap fulfills the step.FuncProvider interface.
 | 
			
		||||
func (this *Provider) FuncMap () template.FuncMap {
 | 
			
		||||
	return template.FuncMap {
 | 
			
		||||
		"test": funcTest,
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func funcTest () string {
 | 
			
		||||
	return "Test plugin"
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user